51 lines
1.6 KiB
Markdown
51 lines
1.6 KiB
Markdown
|
# Build and deploy Mobilizon with docker
|
||
|
|
||
|
You will need to :
|
||
|
- build the image
|
||
|
- adapte env file
|
||
|
- run docker-compose
|
||
|
|
||
|
## Build the image
|
||
|
|
||
|
docker build -t mymobilizon -f docker/prod/Dockerfile .
|
||
|
|
||
|
## Adapt env file
|
||
|
|
||
|
cp env .env
|
||
|
|
||
|
- Edit .env content with your params.
|
||
|
- Edit docker-compose file with your params (environment section for mobilizon & posgres).
|
||
|
|
||
|
You can generate `MOBILIZON_INSTANCE_SECRET_KEY_BASE` and `MOBILIZON_INSTANCE_SECRET_KEY` with:
|
||
|
|
||
|
gpg --gen-random --armor 1 50
|
||
|
|
||
|
## run docker-compose
|
||
|
|
||
|
docker-compose -f docker-compose-simple.yml up
|
||
|
# set user for volumes
|
||
|
sudo chown 999:999 db public wal public/upload
|
||
|
# in another shell
|
||
|
docker-compose -f docker-compose-simple.yml exec -u 0 mobilizon bash
|
||
|
su - mobilizon
|
||
|
# backup secret
|
||
|
mv config/prod.secret.exs config/prod.secret.exs.env
|
||
|
# run config generation
|
||
|
MIX_ENV=prod mix mobilizon.instance gen -f
|
||
|
# reply anything (not used after) except for :
|
||
|
# - What is the name of your database? [mobilizon_prod]
|
||
|
# - What is the user used to connect to your database? [mobilizon]
|
||
|
# - What is the password used to connect to your database? [autogenerated]
|
||
|
# get secret env based bak
|
||
|
mv config/prod.secret.exs.env config/prod.secret.exs
|
||
|
# run the db init script as root
|
||
|
exit
|
||
|
psql -U postgres -p 5432 -h postgres -f setup_db.psql
|
||
|
# delete db init sript
|
||
|
rm setup_db.psql
|
||
|
# create an admin with mobilizon user
|
||
|
su - mobilizon
|
||
|
cd /app
|
||
|
MIX_ENV=prod mix mobilizon.users.new pascoual@tedomum.fr --password mobilizon
|
||
|
# exit with ctrl+d (twice times)
|