Restore Docker development

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2021-07-02 15:48:40 +02:00
parent d0ac3de354
commit 8310ae46cd
No known key found for this signature in database
GPG key ID: A061B9DDE0CA0773
4 changed files with 45 additions and 22 deletions

25
.env.template Normal file
View file

@ -0,0 +1,25 @@
# Database settings
POSTGRES_USER=mobilizon
POSTGRES_PASSWORD=changethis
POSTGRES_DB=mobilizon
POSTGRES_PORT=5432
# Instance configuration
MOBILIZON_INSTANCE_REGISTRATIONS_OPEN=false
MOBILIZON_INSTANCE_NAME=My Mobilizon Instance
MOBILIZON_INSTANCE_HOST=mobilizon.lan
MOBILIZON_INSTANCE_PORT=4000
MOBILIZON_INSTANCE_SECRET_KEY_BASE=changethis
MOBILIZON_INSTANCE_SECRET_KEY=changethis
MOBILIZON_INSTANCE_EMAIL=noreply@mobilizon.lan
MOBILIZON_REPLY_EMAIL=contact@mobilizon.lan
# Email settings
MOBILIZON_SMTP_SERVER=localhost
MOBILIZON_SMTP_PORT=25
MOBILIZON_SMTP_HOSTNAME=localhost
MOBILIZON_SMTP_USERNAME=noreply@mobilizon.lan
MOBILIZON_SMTP_PASSWORD=password
MOBILIZON_SMTP_SSL=false

View file

@ -1,6 +1,6 @@
FROM bitwalker/alpine-elixir:latest FROM elixir:alpine
RUN apk add --no-cache inotify-tools postgresql-client yarn file make gcc libc-dev argon2 imagemagick cmake build-base libwebp-tools bash ncurses RUN apk add --no-cache inotify-tools postgresql-client yarn file make gcc libc-dev argon2 imagemagick cmake build-base libwebp-tools bash ncurses git
RUN mix local.hex --force && mix local.rebar --force RUN mix local.hex --force && mix local.rebar --force

View file

@ -1,19 +1,12 @@
import Config import Config
# For development, we disable any cache and enable
# debugging and code reloading.
#
# The watchers configuration can be used to run external
# watchers to your application. For example, we use it
# with brunch.io to recompile .js and .css sources.
config :mobilizon, Mobilizon.Web.Endpoint, config :mobilizon, Mobilizon.Web.Endpoint,
http: [ http: [
ip: {127, 0, 0, 1}, port: String.to_integer(System.get_env("MOBILIZON_INSTANCE_HOST_PORT", "4000"))
port: 4000
], ],
url: [ url: [
host: System.get_env("MOBILIZON_INSTANCE_HOST", "mobilizon.local"), host: System.get_env("MOBILIZON_INSTANCE_HOST", "mobilizon.local"),
port: 80, port: String.to_integer(System.get_env("MOBILIZON_INSTANCE_HOST_PORT", "80")),
scheme: "http" scheme: "http"
], ],
debug_errors: true, debug_errors: true,

View file

@ -1,13 +1,14 @@
version: "3" version: "3.2"
services: services:
postgres: postgres:
container_name: mobilizon_db container_name: mobilizon_db
restart: unless-stopped restart: unless-stopped
image: postgis/postgis:13-3.0 image: postgis/postgis
environment: environment:
POSTGRES_PASSWORD: postgres - POSTGRES_USER
POSTGRES_DB: mobilizon_dev - POSTGRES_PASSWORD
- POSTGRES_DB
- POSTGRES_PORT
volumes: volumes:
- pgdata:/var/lib/postgresql/data - pgdata:/var/lib/postgresql/data
api: api:
@ -17,23 +18,27 @@ services:
volumes: volumes:
- ".:/app" - ".:/app"
ports: ports:
- "4000:4000" - 4000:4000
depends_on: depends_on:
- postgres - postgres
environment: environment:
MIX_ENV: "dev" MIX_ENV: "dev"
DOCKER: "true" DOCKER: "true"
MOBILIZON_INSTANCE_NAME: My Mobilizon Instance MOBILIZON_INSTANCE_NAME: My Mobilizon Instance
MOBILIZON_INSTANCE_HOST: mobilizon.me MOBILIZON_INSTANCE_HOST: localhost
MOBILIZON_INSTANCE_HOST_PORT: 4000
MOBILIZON_INSTANCE_PORT: 4000
MOBILIZON_INSTANCE_EMAIL: noreply@mobilizon.me MOBILIZON_INSTANCE_EMAIL: noreply@mobilizon.me
MOBILIZON_INSTANCE_REGISTRATIONS_OPEN: "true" MOBILIZON_INSTANCE_REGISTRATIONS_OPEN: "true"
MOBILIZON_DATABASE_PASSWORD: postgres MOBILIZON_DATABASE_PASSWORD: ${POSTGRES_PASSWORD}
MOBILIZON_DATABASE_USERNAME: postgres MOBILIZON_DATABASE_USERNAME: ${POSTGRES_USER}
MOBILIZON_DATABASE_DBNAME: mobilizon_dev MOBILIZON_DATABASE_DBNAME: ${POSTGRES_DB}
MOBILIZON_DATABASE_HOST: postgres MOBILIZON_DATABASE_HOST: postgres
MOBILIZON_DATABASE_PORT: ${POSTGRES_PORT}
command: > command: >
sh -c "cd js && sh -c "cd js &&
yarn install && yarn --cwd "js" install &&
yarn --cwd "js" run build:pictures &&
cd ../ && cd ../ &&
mix deps.get && mix deps.get &&
mix compile && mix compile &&