1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- MODE=development
- export DB_BASE_DIR=/path/to/directory/where/db/will/be/created
- export UPLOAD_FOLDER=/path/where/contributions/will/be/uploaded
- export TM_URL=http://location/of/tm/to/tmx
- export DOC_URL=http://location/of/doc/to/tmx
- export ELASTICSEARCH_URL=http://location/of/elasticsearch
- export PROJECT_NAME="PROJECT_NAME"
- curl -X DELETE "$ELASTICSEARCH_URL/users"
- curl -X DELETE "$ELASTICSEARCH_URL/resources"
- mkdir -p "$DB_BASE_DIR" "$UPLOAD_FOLDER"
- # In development mode, delete the database and recreate it with a few test users and resources each time application is started
- if [[ "$MODE" == "development" ]]; then
- export FLASK_DEBUG=1
- export FLASK_APP=dev_run.py
- export FLASK_RUN_PORT=5000
- export DB_FILENAME="stor_dev"
- rm -rf "$DB_BASE_DIR/$DB_FILENAME.sqlite" "$UPLOAD_FOLDER/*"
- cp -r dev-res/* "$UPLOAD_FOLDER/"
- flask translate compile
- flask run
- # In staging_setup mode, create an empty database with just the user groups and an admin user set up
- # Note: this is not to be used for actual staging runs, but only to generate the empty database file
- elif [[ "$MODE" == "staging_setup" ]]; then
- export FLASK_APP=staging_setup.py
- export FLASK_RUN_PORT=5000
- export STAGING_SUPERUSER_EMAIL="superuser@test.com"
- export STAGING_SUPERUSER_PASSWORD="staging123!"
- export DB_FILENAME="stor_staging"
- rm -rf "$DB_BASE_DIR/$DB_FILENAME.sqlite"
- flask run
- # In production mode, migrate an existing database
- elif [[ "$MODE" == "production" ]]; then
- export FLASK_APP=run.py
- export DB_FILENAME="stor"
- flask translate compile
- gunicorn -c gunicorn.conf.py run:app
- fi
|