diff --git a/README.md b/README.md index f17cf3b..547f551 100644 --- a/README.md +++ b/README.md @@ -3,10 +3,42 @@ Open Source web-based personal expenses tool. +## Setup prod env +1. Install prerequisites: + 1. docker + 2. docker compose + 3. git + +2. Clone this git repository: +```bash +git clone https://gitea.communiquons.org/pierre/MoneyMgr +cd MoneyMgr/docker_prod +``` + +3. Copy and adapt env values +```bash +cp .env.sample .env +nano .env +``` + +4. Create required directories: + +```bash +mkdir -p storage/{db,redis-data,redis-conf,minio} +``` + +5. Start containers + +```bash +docker compose up +``` + +6. Checkout http://localhost:8000/ + ## Setup dev env 1. Install prerequisites: 1. docker - 2. docker-compose + 2. docker compose 3. rust 4. node diff --git a/docker_prod/.env.sample b/docker_prod/.env.sample new file mode 100644 index 0000000..1cd21a2 --- /dev/null +++ b/docker_prod/.env.sample @@ -0,0 +1,7 @@ +MINIO_ROOT_USER=rootuser +MINIO_ROOT_PASSWORD=rootpassword +DB_USER=db_user +DB_PASSWORD=db_password +REDIS_PASS=redis_password +WEBSITE_ORIGIN=http://localhost:8000 +APP_SECRET=secretsecretsecretsecretsecretsecretsecretsecretsecretsecretsecret \ No newline at end of file diff --git a/docker_prod/.gitignore b/docker_prod/.gitignore new file mode 100644 index 0000000..51ee488 --- /dev/null +++ b/docker_prod/.gitignore @@ -0,0 +1,2 @@ +.env +storage diff --git a/docker_prod/dex/dex.config.yaml b/docker_prod/dex/dex.config.yaml new file mode 100644 index 0000000..6081304 --- /dev/null +++ b/docker_prod/dex/dex.config.yaml @@ -0,0 +1,27 @@ +issuer: http://localhost:9001/dex + +storage: + type: memory + +web: + http: 0.0.0.0:9001 + +oauth2: + # Automate some clicking + # Note: this might actually make some tests pass that otherwise wouldn't. + skipApprovalScreen: false + +connectors: + # Note: this might actually make some tests pass that otherwise wouldn't. + - type: mockCallback + id: mock + name: Example + +# Basic OP test suite requires two clients. +staticClients: + - id: foo + secret: bar + redirectURIs: + - http://localhost:8000/oidc_cb + + name: Project diff --git a/docker_prod/docker-compose.yml b/docker_prod/docker-compose.yml new file mode 100644 index 0000000..3fc66f3 --- /dev/null +++ b/docker_prod/docker-compose.yml @@ -0,0 +1,72 @@ +services: + minio: + image: minio/minio + user: "1000" + environment: + - MINIO_ROOT_USER=$MINIO_ROOT_USER + - MINIO_ROOT_PASSWORD=$MINIO_ROOT_PASSWORD + volumes: + - ./storage/minio:/data + command: [ "minio", "server", "/data", "--console-address", ":9090" ] + ports: + - 9000:9000 + - 9090:9090 + expose: + - 9000 + + db: + image: postgres + user: "1000" + ports: + - "5432:5432" + expose: + - 5432 + environment: + - POSTGRES_USER=$DB_USER + - POSTGRES_PASSWORD=$DB_PASSWORD + - POSTGRES_DB=moneymgr + volumes: + - ./storage/db:/var/lib/postgresql/data + + oidc: + image: dexidp/dex + user: "1000" + expose: + - 9001 + ports: + - 9001:9001 + volumes: + - ./dex:/conf:ro + command: [ "dex", "serve", "/conf/dex.config.yaml" ] + + redis: + image: redis:alpine + user: "1000" + command: redis-server --requirepass ${REDIS_PASS:-secretredis} + expose: + - 6379 + volumes: + - ./storage/redis-data:/data + - ./storage/redis-conf:/usr/local/etc/redis/redis.conf + + moneymgr: + image: pierre42100/moneymgr_backend + user: "1000" + ports: + - 8000:8000 + environment: + - WEBSITE_ORIGIN=${WEBSITE_ORIGIN} + - SECRET=${APP_SECRET} + - DB_HOST=db + - DB_USERNAME=$DB_USER + - DB_PASSWORD=$DB_PASSWORD + - DB_NAME=moneymgr + - OIDC_CONFIGURATION_URL=http://oidc:9001/dex/.well-known/openid-configuration + - OIDC_PROVIDER_NAME=OIDC + - OIDC_CLIENT_ID=foo + - OIDC_CLIENT_SECRET=bar + - S3_ENDPOINT=http://minio:9000 + - S3_ACCESS_KEY=$MINIO_ROOT_USER + - S3_SECRET_KEY=$MINIO_ROOT_PASSWORD + - REDIS_HOSTNAME=redis + - REDIS_PASSWORD=${REDIS_PASS:-secretredis} \ No newline at end of file