2020-10-19 01:01:59 +02:00
|
|
|
# Build and deploy Mobilizon with docker
|
|
|
|
|
|
|
|
You will need to :
|
|
|
|
- build the image
|
2020-10-22 15:19:01 +02:00
|
|
|
- tune the environment file
|
|
|
|
- use docker-compose to run the service
|
2020-10-19 01:01:59 +02:00
|
|
|
|
|
|
|
## Build the image
|
|
|
|
|
2020-10-22 15:19:01 +02:00
|
|
|
git clone https://forge.tedomum.net/tedomum/mobilizon
|
|
|
|
cd mobilizon
|
|
|
|
docker build -t mobilizon -f docker/production/Dockerfile .
|
2020-10-19 01:01:59 +02:00
|
|
|
|
2020-10-22 15:19:01 +02:00
|
|
|
## Update the env file
|
2020-10-19 01:01:59 +02:00
|
|
|
|
2020-10-22 15:19:01 +02:00
|
|
|
cd docker/production/
|
2020-10-27 19:09:10 +01:00
|
|
|
cp env.template .env
|
2020-10-19 01:01:59 +02:00
|
|
|
|
2020-10-22 15:19:01 +02:00
|
|
|
Edit the `.env` content with your own settings.
|
2020-10-27 16:40:14 +01:00
|
|
|
More settings can be added in .env, see all in docker-compose.yml file.
|
2020-10-19 01:01:59 +02:00
|
|
|
|
|
|
|
You can generate `MOBILIZON_INSTANCE_SECRET_KEY_BASE` and `MOBILIZON_INSTANCE_SECRET_KEY` with:
|
|
|
|
|
|
|
|
gpg --gen-random --armor 1 50
|
|
|
|
|
2020-10-22 15:19:01 +02:00
|
|
|
## Run the service
|
|
|
|
|
|
|
|
Start by initializing and running the database:
|
|
|
|
|
|
|
|
docker-compose up -d db
|
|
|
|
|
|
|
|
Instanciate required Postgres extensions:
|
|
|
|
|
|
|
|
docker-compose exec db psql -U <username>
|
|
|
|
# CREATE EXTENSION pg_trgm;
|
|
|
|
# CREATE EXTENSION unaccent;
|
|
|
|
|
|
|
|
|
|
|
|
Then run migrations:
|
|
|
|
|
2020-10-27 16:40:14 +01:00
|
|
|
docker-compose run --rm mobilizon eval Mobilizon.CLI.migrate
|
2020-10-22 15:19:01 +02:00
|
|
|
|
|
|
|
Finally, run the application:
|
|
|
|
|
|
|
|
docker-compose up -d mobilizon
|
|
|
|
|
|
|
|
## Update the service
|
|
|
|
|
|
|
|
Pull the latest image, then run the migrations:
|
|
|
|
|
|
|
|
docker-compose pull mobilizon
|
2020-10-27 16:40:14 +01:00
|
|
|
docker-compose run --rm mobilizon eval Mobilizon.CLI.migrate
|
2020-10-22 15:19:01 +02:00
|
|
|
|
|
|
|
Finally, update the service:
|
|
|
|
|
|
|
|
docker-compose up -d mobilizon
|