From ad261f00467c1e1fc31b181ecd031b5a6e1e5144 Mon Sep 17 00:00:00 2001 From: "mike.michel" Date: Thu, 5 Sep 2024 00:08:54 +0200 Subject: [PATCH 1/3] improve docker-compose --- apps/docs/quickstart.mdx | 24 +++++++++++++----------- docker-compose.dev.yaml | 34 ++++++++++++++++++++++++---------- 2 files changed, 37 insertions(+), 21 deletions(-) diff --git a/apps/docs/quickstart.mdx b/apps/docs/quickstart.mdx index 07cec42e9..970a0ee40 100644 --- a/apps/docs/quickstart.mdx +++ b/apps/docs/quickstart.mdx @@ -48,7 +48,7 @@ git clone https://github.com/gitroomhq/gitroom Copy the `.env.example` file to `.env` and fill in the values ```bash .env -DATABASE_URL="postgres database URL" +DATABASE_URL="postgres database URL i.g. postgresql://postiz-local:postiz-local-pwd@0.0.0.0:5432/postiz-db-local" REDIS_URL="redis database URL" JWT_SECRET="random string for your JWT secret, make it long" FRONTEND_URL="By default: http://localhost:4200" @@ -73,6 +73,7 @@ CLOUDFLARE_BUCKET_URL="Cloudflare R2 Backet URL" NX_ADD_PLUGINS=false IS_GENERAL="true" # required for now ``` + @@ -80,19 +81,20 @@ IS_GENERAL="true" # required for now ```bash Terminal npm install ``` - - -```bash Terminal -docker compose -f "docker-compose.dev.yaml" up -``` - -```bash Terminal -npm run prisma-db-push -``` - +{' '} + + Using this you can skip the redis and postgres steps from above. This will + also give you pg-admin to check the database. ```bash Terminal docker compose + -f "docker-compose.dev.yaml" up ``` + + +{' '} + + ```bash Terminal npm run prisma-db-push ``` + ```bash Terminal diff --git a/docker-compose.dev.yaml b/docker-compose.dev.yaml index 5948c53f6..55641b1b3 100644 --- a/docker-compose.dev.yaml +++ b/docker-compose.dev.yaml @@ -1,26 +1,40 @@ -version: '3.9' - services: - gitroom-postgres: + postiz-postgres: image: postgres:14.5 - container_name: gitroom-postgres + container_name: postiz-postgres restart: always environment: - POSTGRES_PASSWORD: gitroom-local-pwd - POSTGRES_USER: gitroom-local - POSTGRES_DB: gitroom-db-local + POSTGRES_PASSWORD: postiz-local-pwd + POSTGRES_USER: postiz-local + POSTGRES_DB: postiz-db-local volumes: - postgres-volume:/var/lib/postgresql/data ports: - 5432:5432 - gitroom-redis: + networks: + - postiz-network + postiz-pg-admin: + image: dpage/pgadmin4 + container_name: postiz-pg-admin + restart: always + ports: + - 8081:80 + environment: + PGADMIN_DEFAULT_EMAIL: admin@admin.com + PGADMIN_DEFAULT_PASSWORD: admin + networks: + - postiz-network + postiz-redis: image: redis:7.2 - container_name: gitroom-redis + container_name: postiz-redis restart: always ports: - 6379:6379 - volumes: postgres-volume: external: false + +networks: + postiz-network: + external: false From 3477fc7a322af4fd9e462c62eb884a7531c5f902 Mon Sep 17 00:00:00 2001 From: jamesread Date: Sat, 7 Sep 2024 01:49:53 +0100 Subject: [PATCH 2/3] doc: Simplify quickstart instructions for end users --- apps/docs/emails.mdx | 14 ++++++++------ apps/docs/howitworks.mdx | 12 ++++++------ apps/docs/quickstart.mdx | 36 +++++++++++++++++++----------------- 3 files changed, 33 insertions(+), 29 deletions(-) diff --git a/apps/docs/emails.mdx b/apps/docs/emails.mdx index 1e45b7041..e7c7ea455 100644 --- a/apps/docs/emails.mdx +++ b/apps/docs/emails.mdx @@ -3,14 +3,16 @@ title: Email Notifications description: How to send notifications to users --- -At the moment we are using Resend to send email notifications to users, and might be changed the Novu later. +Postiz uses Resend to send email notifications to users. Emails are currently +required as part of the new-user creation process, which sends an activation +email. -Register to [Resend](https://resend.com) connect your domain. -Copy your API Key. -Head over to .env file and add the following line. +* Register to [Resend](https://resend.com), and connect your domain. +* Copy your API Key from the Resend control panel. +* Open the .env file and edit the following line. ```env -RESEND_API_KEY="" +RESEND_API_KEY="" ``` -Feel free to contribute other providers to send email notifications. \ No newline at end of file +Feel free to contribute other providers to send email notifications. diff --git a/apps/docs/howitworks.mdx b/apps/docs/howitworks.mdx index 8232d9d84..aa1fa7dc4 100644 --- a/apps/docs/howitworks.mdx +++ b/apps/docs/howitworks.mdx @@ -8,13 +8,13 @@ Unlike other NX project, this project has one `.env` file that is shared between It makes it easier to develop and deploy the project.

When deploying to websites like [Railway](https://railway.app) or [Heroku](https://heroku.com), you can use a shared environment variables for all the apps.

-**At the moment it has 6 project:** +**At the moment it has 6 projects:** -- **Backend** - NestJS based system -- **Workers** - NestJS based workers connected to a Redis Queue. -- **Cron** - NestJS scheduler to run cron jobs. -- **Frontend** - NextJS based control panel. -- **Docs** - Mintlify based documentation website. +- [Frontend](#frontend) - Provides the Web user interface, talks to the Backend. +- [Backend](#backend) - Does all the real work, provides an API for the frontend, and posts work to the redis queue. +- [Workers](#worker) - Consumes work from the Redis Queue. +- [Cron](#cron) - Run jobs at scheduled times. +- [Docs](#docs) - This documentation site! -If you don't, you can install [Docker](https://www.docker.com/products/docker-desktop) and run: +#### Option A) Postgres and Redis as Single containers -```bash +You can install [Docker](https://www.docker.com/products/docker-desktop) and run: + +```bash Terminal docker run -e POSTGRES_USER=root -e POSTGRES_PASSWORD=your_password --name postgres -p 5432:5432 -d postgres +docker run --name redis -p 6379:6379 -d redis ``` -### Redis +#### Option B) Postgres and Redis as docker-compose -Make sure you have Redis installed on your machine.
-If you don't, you can install [Docker](https://www.docker.com/products/docker-desktop) and run: +Download the [docker-compose.yaml file here](https://raw.githubusercontent.com/gitroomhq/postiz-app/main/docker-compose.dev.yaml), +or grab it from the repository in the next step. -```bash -docker run --name redis -p 6379:6379 -d redis +```bash Terminal +docker compose -f "docker-compose.dev.yaml" up ``` -## Installation +## Build Postiz @@ -44,7 +52,7 @@ git clone https://github.com/gitroomhq/gitroom ``` - + Copy the `.env.example` file to `.env` and fill in the values ```bash .env @@ -82,12 +90,6 @@ npm install ``` - -```bash Terminal -docker compose -f "docker-compose.dev.yaml" up -``` - - ```bash Terminal npm run prisma-db-push From 56d04d962e560de0b629cc75dc362b228d923ea6 Mon Sep 17 00:00:00 2001 From: jamesread Date: Mon, 9 Sep 2024 20:22:58 +0100 Subject: [PATCH 3/3] Add NEXT JS Build cache --- .github/workflows/build.yaml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index a90380e59..9c421bbf2 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -1,3 +1,4 @@ +--- name: Build on: @@ -20,5 +21,18 @@ jobs: with: node-version: ${{ matrix.node-version }} cache: 'npm' + + # https://nextjs.org/docs/pages/building-your-application/deploying/ci-build-caching#github-actions + - uses: actions/cache@v4 + with: + path: | + ~/.npm + ${{ github.workspace }}/.next/cache + + key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx') }} + restore-keys: | + ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}- + + - run: npm ci - run: npm run build