Flask + Blueprint app for running small WF utilities, apps have largely been retired since 2018
654
App is exposed over port 5000
docker-compose up
docker run -d -e "POSTGRES_PASSWORD=iamaninsecurepassword" -e "POSTGRES_USER=sunbeam" -e "POSTGRES_DB=sunbeam" --name="sunbeam_postgres_prod" postgres:11.3
docker run -d --name "sunbeam_memcached_prod" memcached:1.5.16-alpine
The following exposes port 5005 and loads a local .env file
docker build -t sunbeam_prod .
docker run --env-file ./.env -e "DATABASE_URL=postgresql://sunbeam:iamaninsecurepassword@sunbeam_postgres_prod:5432/sunbeam" -e "MEMCACHEDCLOUD_SERVERS=sunbeam_memcached_prod" --link="sunbeam_postgres_prod" --link="sunbeam_memcached_prod" --name="sunbeam_prod" -p 5005:80 sunbeam_prod
Install Python >=3.7
Clone repo
git clone https://github.com/WildflowerSchools/sunbeam/
Change to directory
cd sunbeam
Set up virtual env
python3.7 -m venv ./venv
Activate virtual env
. venv/bin/activate
Install python packages (--upgrade is used to force updates to github sourced pip packages)
find . -path "*requirements*" -name "development.txt" -maxdepth 4 -exec pip install --upgrade -r {} \;
Database
Create databases
psql -c "create database sunbeam_development"
psql -c "create database sunbeam_test"
Add a user
psql -c "create role sunbeam login"
Set environment variables, either in the shell, or in a .env file (see https://github.com/theskumar/python-dotenv)
TEST_DATABASE_URL="postgresql://sunbeam@localhost:5432/sunbeam_test"
DEVELOPMENT_DATABASE_URL="postgresql://sunbeam@localhost:5432/sunbeam_development"
SECRET_KEY="SOMETHINGSECRET"
Set up global application variables
See "Global environment variables" section below
Run database migrations
./flask.sh db upgrade
./flask.sh test db upgrade
ERROR:
...
ld: library not found for -lssl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'clang' failed with exit status 1
...
FIX:
export LDFLAGS="-I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib"
# rerun pip install command as documented above
./flask.sh run
./test.sh
Download nltk data if running apply_blueprint tests
import nltk
nltk.download('wordnet')
heroku config:set APP_CONFIG_MODE=production
git tag -a v`date -u "+%Y-%m-%d-%H-%M-%S"` -m ""
git push origin `git describe --abbrev=0`
Add flask cli command for copy generators/blueprint to app/whatever
blueprint_name in tests feels leaky
nltk_data dir in root is leaky; should be beneath apply_blueprint (since used there)
config is still a global namspace; isolate each blueprint's config?
Content type
Image
Digest
Size
300.1 MB
Last updated
about 6 years ago
docker pull wildflowerschools/sunbeam:v2020-07-31-23-57-21