CSEntry
Control System Entry web server.
Development
You can use docker for development:
-
Clone the repository
-
Create the database. Data will be stored under "./data" by default. You can export the PGDATA_VOLUME variable to use another directory:
# Start only postgres so it has time to initialize $ docker-compose up -d postgres or $ make db # Initialize the database $ docker-compose run --rm web flask db upgrade head $ docker-compose run --rm web flask create_defaults or $ make init_db
-
Start the application:
$ docker-compose up
-
Open your browser and go to http://localhost:8000.
-
To run the tests:
$ make test
Once the database has been created, you only need to run docker-compose up to start the app.
Testing
By default docker-compose reads both docker-compose.yml and docker-compose.override.yml. In docker-compose.override.yml, the current directory is mounted as a volume. This is great for development.
To test the built image, we should only use the docker-compose.yml (and ignore docker-compose.override.yml).
-
Create the database:
# Start only postgres so it has time to initialize $ docker-compose -f docker-compose.yml up -d postgres or $ make db_image
-
Run the tests:
$ docker-compose -f docker-compose.yml run --rm web or $ make test_image
Backup & restore
To dump the database:
$ docker run --rm --link csentry_postgres:postgres --net csentry_default -e PGPASSWORD="<csentry_password>"
postgres:10 pg_dump -h postgres -U ics csentry_db | gzip > csentry_db.sql.gz
To restore the database:
$ gunzip -c csentry_db.sql.gz | docker run --rm --link csentry_postgres:postgres --net csentry_default
-e PGPASSWORD="<csentry_password>" -i postgres:10 psql -h postgres -U ics csentry_db
Dependencies
The initial dependencies were generated using:
$ docker run --rm -it -v $(pwd):/app continuumio/miniconda3:latest bash
$ conda config --add channels conda-forge
$ conda create -n csentry python=3.6 flask alembic flask-debugtoolbar flask-login flask-sqlalchemy flask-wtf pillow psycopg2 pytest pytest-cov qrcode whitenoise factory_boy flask-admin pyjwt ldap3 flask-mail flask-migrate flask-jwt-extended
$ source activate csentry
$ pip install flask-ldap3-login sqlalchemy-citext sqlalchemy-continuum pytest-factoryboy git+https://github.com/beenje/flask-bootstrap@4.0.0-beta.1.dev1
$ conda env export > /app/environment.yml