diff --git a/Dockerfile b/Dockerfile index 261a5910e..8521e893b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -49,4 +49,4 @@ FROM node:16-alpine COPY --from=builder /ghostfolio/dist/apps /ghostfolio/apps WORKDIR /ghostfolio/apps/api EXPOSE 3333 -CMD [ "node", "main" ] +CMD [ "yarn", "start:prod" ] diff --git a/README.md b/README.md index 712776bb9..729a2802a 100644 --- a/README.md +++ b/README.md @@ -114,14 +114,6 @@ Run the following command to start the Docker images from [Docker Hub](https://h docker-compose --env-file ./.env -f docker/docker-compose.yml up -d ``` -##### Setup Database - -Run the following command to setup the database once Ghostfolio is running: - -```bash -docker-compose --env-file ./.env -f docker/docker-compose.yml exec ghostfolio yarn database:setup -``` - #### b. Build and run environment Run the following commands to build and start the Docker images: @@ -131,14 +123,6 @@ docker-compose --env-file ./.env -f docker/docker-compose.build.yml build docker-compose --env-file ./.env -f docker/docker-compose.build.yml up -d ``` -##### Setup Database - -Run the following command to setup the database once Ghostfolio is running: - -```bash -docker-compose --env-file ./.env -f docker/docker-compose.build.yml exec ghostfolio yarn database:setup -``` - #### Fetch Historical Data Open http://localhost:3333 in your browser and accomplish these steps: @@ -150,8 +134,8 @@ Open http://localhost:3333 in your browser and accomplish these steps: #### Upgrade Version 1. Increase the version of the `ghostfolio/ghostfolio` Docker image in `docker/docker-compose.yml` -1. Run the following command to start the new Docker image: `docker-compose --env-file ./.env -f docker/docker-compose.yml up -d` -1. Then, run the following command to keep your database schema in sync: `docker-compose --env-file ./.env -f docker/docker-compose.yml exec ghostfolio yarn database:migrate` +1. Run the following command to start the new Docker image: `docker-compose --env-file ./.env -f docker/docker-compose.yml up -d` +At each start container will automatically upgrade database schema if needed. ### Run with _Unraid_ (Community) diff --git a/package.json b/package.json index 33e2c7204..c13b89240 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,6 @@ "build:dev": "nx run api:build && nx run client:build --localize && yarn replace-placeholders-in-build", "build:storybook": "nx run ui:build-storybook", "clean": "rimraf dist", - "database:baseline": "sh ./prisma/baseline.sh", "database:format-schema": "prisma format", "database:generate-typings": "prisma generate", "database:gui": "prisma studio", @@ -42,7 +41,7 @@ "replace-placeholders-in-build": "node ./replace.build.js", "start": "node dist/apps/api/main", "start:client": "ng serve client --configuration=development-en --hmr -o", - "start:prod": "node apps/api/main", + "start:prod": "yarn database:migrate && yarn database:seed && node main", "start:server": "nx serve api --watch", "start:storybook": "nx run ui:storybook", "test": "nx test", diff --git a/prisma/baseline.sh b/prisma/baseline.sh deleted file mode 100644 index 90fe3f894..000000000 --- a/prisma/baseline.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -# List all migration scripts based on the directory name and mark the migration as "applied" - -for directory in ./prisma/migrations/*/; do - migration=$(echo "$directory" | sed 's/.\/prisma\/migrations\///' | sed 's/\///') - yarn prisma migrate resolve --applied $migration -done