From ed1136999a516ffc3336581d32953921494d953c Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Tue, 21 Dec 2021 20:22:58 +0100 Subject: [PATCH] Feature/extend documentation for self hosting (#565) * Extend documentation for self-hosting * Add tag "latest" to docker image * Update changelog --- CHANGELOG.md | 1 + README.md | 24 +++++++++++++++---- ...ild-local.yml => docker-compose.build.yml} | 20 ++++++++-------- docker/docker-compose.dev.yml | 22 +++++++++++++++++ docker/docker-compose.yml | 18 +++++++------- publish-docker-image.sh | 4 ++-- 6 files changed, 64 insertions(+), 25 deletions(-) rename docker/{docker-compose-build-local.yml => docker-compose.build.yml} (100%) create mode 100644 docker/docker-compose.dev.yml diff --git a/CHANGELOG.md b/CHANGELOG.md index 82c20733c..5f4e591e4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Added support for cryptocurrency _Solana_ (`SOL-USD`) +- Extended the documentation for self-hosting with the [official Ghostfolio Docker image](https://hub.docker.com/r/ghostfolio/ghostfolio) ### Fixed diff --git a/README.md b/README.md index 03f8dc8a2..653deec6a 100644 --- a/README.md +++ b/README.md @@ -81,19 +81,27 @@ The backend is based on [NestJS](https://nestjs.com) using [PostgreSQL](https:// The frontend is built with [Angular](https://angular.io) and uses [Angular Material](https://material.angular.io) with utility classes from [Bootstrap](https://getbootstrap.com). -## Run with Docker +## Run with Docker (self-hosting) ### Prerequisites - [Docker](https://www.docker.com/products/docker-desktop) -### Setup Docker Image +### a. Run environment -Run the following commands to build and start the Docker image: +Run the following command to start the Docker images from [Docker Hub](https://hub.docker.com/r/ghostfolio/ghostfolio): ```bash -docker-compose -f docker/docker-compose-build-local.yml build -docker-compose -f docker/docker-compose-build-local.yml up +docker-compose -f docker/docker-compose.yml up +``` + +### b. Build and run environment + +Run the following commands to build and start the Docker images: + +```bash +docker-compose -f docker/docker-compose.build.yml build +docker-compose -f docker/docker-compose.build.yml up ``` ### Setup Database @@ -112,6 +120,12 @@ Open http://localhost:3333 in your browser and accomplish these steps: 1. Go to the _Admin Control Panel_ and click _Gather All Data_ to fetch historical data 1. Click _Sign out_ and check out the _Live Demo_ +### Finalization + +1. Create a new user via _Get Started_ +1. Assign the role `ADMIN` to this user (directly in the database) +1. Delete the original _Admin_ (directly in the database) + ### Migrate Database With the following command you can keep your database schema in sync after a Ghostfolio version update: diff --git a/docker/docker-compose-build-local.yml b/docker/docker-compose.build.yml similarity index 100% rename from docker/docker-compose-build-local.yml rename to docker/docker-compose.build.yml index 39d6fcf95..1d2496f9b 100644 --- a/docker/docker-compose-build-local.yml +++ b/docker/docker-compose.build.yml @@ -1,5 +1,15 @@ version: '3.7' services: + ghostfolio: + build: ../ + env_file: + - ../.env + environment: + DATABASE_URL: postgresql://user:password@postgres:5432/ghostfolio-db?sslmode=prefer + REDIS_HOST: 'redis' + ports: + - 3333:3333 + postgres: image: postgres:12 env_file: @@ -10,15 +20,5 @@ services: redis: image: 'redis:alpine' - ghostfolio: - build: ../ - env_file: - - ../.env - environment: - REDIS_HOST: 'redis' - DATABASE_URL: postgresql://user:password@postgres:5432/ghostfolio-db?sslmode=prefer - ports: - - 3333:3333 - volumes: postgres: diff --git a/docker/docker-compose.dev.yml b/docker/docker-compose.dev.yml new file mode 100644 index 000000000..8e5a8ec07 --- /dev/null +++ b/docker/docker-compose.dev.yml @@ -0,0 +1,22 @@ +version: '3.7' +services: + postgres: + image: postgres:12 + container_name: postgres + restart: unless-stopped + ports: + - 5432:5432 + env_file: + - ../.env + volumes: + - postgres:/var/lib/postgresql/data + + redis: + image: 'redis:alpine' + container_name: redis + restart: unless-stopped + ports: + - 6379:6379 + +volumes: + postgres: diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 8e5a8ec07..7c260f3cd 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -1,11 +1,17 @@ version: '3.7' services: + ghostfolio: + image: ghostfolio/ghostfolio + env_file: + - ../.env + environment: + DATABASE_URL: postgresql://user:password@postgres:5432/ghostfolio-db?sslmode=prefer + REDIS_HOST: 'redis' + ports: + - 3333:3333 + postgres: image: postgres:12 - container_name: postgres - restart: unless-stopped - ports: - - 5432:5432 env_file: - ../.env volumes: @@ -13,10 +19,6 @@ services: redis: image: 'redis:alpine' - container_name: redis - restart: unless-stopped - ports: - - 6379:6379 volumes: postgres: diff --git a/publish-docker-image.sh b/publish-docker-image.sh index 310ffb49b..b554f6714 100755 --- a/publish-docker-image.sh +++ b/publish-docker-image.sh @@ -1,5 +1,5 @@ set -xe echo "$DOCKER_HUB_ACCESS_TOKEN" | docker login -u "$DOCKER_HUB_USERNAME" --password-stdin -docker build -t ghostfolio/ghostfolio:$TRAVIS_TAG . -docker push ghostfolio/ghostfolio:$TRAVIS_TAG +docker build -t ghostfolio/ghostfolio:$TRAVIS_TAG -t ghostfolio/ghostfolio:latest . +docker push ghostfolio/ghostfolio --all-tags