Skip to content
Snippets Groups Projects
Benjamin Bertrand's avatar
Benjamin Bertrand authored
JIRA INFRA-2316 #action In Progress
738544e3
History

CSEntry

https://sonarqube.esss.lu.se/api/project_badges/measure?project=csentry&metric=alert_status

Control System Entry web server.

Development

You can use docker for development:

  1. Clone the repository

  2. 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
  3. Start the application:

    $ docker-compose up
  4. Open your browser and go to http://localhost:8000.

  5. 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).

  1. 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
  2. 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