Skip to content

Commit

Permalink
Merge branch 'main' into github-actions-build-add-cache
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesread authored Sep 9, 2024
2 parents 15306eb + 89127fb commit 8c4b26b
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 41 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: Build

on:
Expand All @@ -23,5 +24,16 @@ jobs:
cache-dependency-path: |
**/package-lock.json
# 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
14 changes: 8 additions & 6 deletions apps/docs/emails.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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="<your-api-key-here>"
```

Feel free to contribute other providers to send email notifications.
Feel free to contribute other providers to send email notifications.
12 changes: 6 additions & 6 deletions apps/docs/howitworks.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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.<br /><br />
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.<br /><br />

**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!

<img
src="/images/arch.png"
Expand Down
40 changes: 21 additions & 19 deletions apps/docs/quickstart.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
title: 'Quickstart'
---

At the moment it is necessary to build the project locally - some dependencies
like redis and postgres can run as docker containers, but there is no docker
container for Postiz just yet.

## Prerequisites

To run the project you need to have multiple things:
Expand All @@ -17,25 +21,29 @@ To run the project you need to have multiple things:

A complete guide of how to install NodeJS can be found [here](https://nodejs.org/en/download/).

### PostgreSQL (or any other SQL database)
### PostgreSQL (or any other SQL database) & Redis

Make sure you have PostgreSQL installed on your machine.

Make sure you have PostgreSQL installed on your machine.<br />
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.<br />
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

<Steps>
<Step title="Clone the repository">
Expand All @@ -44,11 +52,11 @@ git clone https://github.com/gitroomhq/gitroom
```
</Step>

<Step title="Copy environment variables">
<Step title="Set environment variables">
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"
Expand All @@ -73,21 +81,15 @@ CLOUDFLARE_BUCKET_URL="Cloudflare R2 Backet URL"
NX_ADD_PLUGINS=false
IS_GENERAL="true" # required for now
```

</Step>

<Step title="Install the dependencies">

```bash Terminal
npm install
```
</Step>

<Step title="Setup postgres & redis via docker compose">
```bash Terminal
docker compose -f "docker-compose.dev.yaml" up
```
</Step>

<Step title="Generate the prisma client and run the migrations">
```bash Terminal
npm run prisma-db-push
Expand Down
34 changes: 24 additions & 10 deletions docker-compose.dev.yaml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 8c4b26b

Please sign in to comment.