frogress/DOCKER.md

81 lines
3.6 KiB
Markdown

# Docker
There are 2 images that make up this project:
- `frogress` - the app itself, based upon [python:3.10-slim](https://hub.docker.com/_/python) image.
- `postgres` - [postgresql](https://hub.docker.com/_/postgres) database
## Configuration
The following environment variables in `.env` are required to run the services via docker-compose:
- `POSTGRES_USER` self-explanatory. Can be set to `user`.
- `POSTGRES_PASSWORD` self-explanatory. Can be set to `pass`.
- `POSTGRES_PORT` to connect to postgres externally. Can be set to `5432`.
- `BACKEND_PORT` the port to access the service to. Can be set to `9000`.
With the above configuration, you will be able to use the API via `http://localhost:9000`. You can also connect to postgres via `localhost:5432`.
## Persisted data
The database data is persisted to `./deployment/postgres/data`, this can be changed within the `docker-compose.yaml` file.
## Daemon
To run the project in the background, add the `--daemon` argument to `docker-compose up`.
## Monitoring
Check what containers are running:
```sh
$ docker-compose ps
Name Command State Ports
----------------------------------------------------------------------------------------------------------------------------------------------
frogress_frogress_1 /entrypoint.sh Up 0.0.0.0:8000->8000/tcp,:::8000->8000/tcp
frogress_postgres_1 docker-entrypoint.sh postgres Up 0.0.0.0:5432->5432/tcp,:::5432->5432/tcp
```
Jump inside the main frogress container:
```sh
$ docker exec -ti frogress_frogress_1 bash
root@7a1645fece43:/frogress#
```
Follow logs for the main frogress container:
```sh
$ docker logs -f frogress_frogress_1
Waiting for database to become available on postgres:5432...
Waiting for database to become available on postgres:5432...
Operations to perform:
Apply all migrations: admin, auth, contenttypes, frog_api, sessions
Running migrations:
Applying contenttypes.0001_initial... OK
Applying auth.0001_initial... OK
Applying admin.0001_initial... OK
Applying admin.0002_logentry_remove_auto_add... OK
Applying admin.0003_logentry_add_action_flag_choices... OK
Applying contenttypes.0002_remove_content_type_name... OK
Applying auth.0002_alter_permission_name_max_length... OK
Applying auth.0003_alter_user_email_max_length... OK
Applying auth.0004_alter_user_username_opts... OK
Applying auth.0005_alter_user_last_login_null... OK
Applying auth.0006_require_contenttypes_0002... OK
Applying auth.0007_alter_validators_add_error_messages... OK
Applying auth.0008_alter_user_username_max_length... OK
Applying auth.0009_alter_user_last_name_max_length... OK
Applying auth.0010_alter_group_name_max_length... OK
Applying auth.0011_update_proxy_permissions... OK
Applying auth.0012_alter_user_first_name_max_length... OK
Applying frog_api.0001_initial... OK
Applying frog_api.0002_remove_entry_version_category_entry_category... OK
Applying frog_api.0003_rename_decompiled_functions_entry_decompiled_chunks_and_more... OK
Applying frog_api.0004_alter_category_options_alter_entry_options_and_more... OK
Applying frog_api.0005_remove_entry_decompiled_bytes_and_more... OK
Applying frog_api.0006_alter_project_auth_key... OK
Applying frog_api.0007_alter_entry_timestamp... OK
Applying frog_api.0008_project_discord_project_repository_project_website... OK
Applying frog_api.0009_alter_project_discord_alter_project_repository_and_more... OK
Applying sessions.0001_initial... OK
Watching for file changes with StatReloader
```