Skip to content

Commit

Permalink
Merge pull request gitroomhq#229 from gitroomhq/docs-docker-and-stuff
Browse files Browse the repository at this point in the history
doc: Docker, and various doc cleanup
  • Loading branch information
jamesread authored Sep 10, 2024
2 parents 3fb7944 + 33de501 commit 74ae05f
Show file tree
Hide file tree
Showing 15 changed files with 330 additions and 111 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@ on:
paths:
- package.json
- apps/**
- !apps/docs/**
- libraries/**

pull_request:
paths:
- package.json
- apps/**
- !apps/docs/**
- libraries/**

jobs:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ on:
- main
paths:
- apps/**
- !apps/docs/**
- libraries/**

pull_request:
paths:
- apps/**
- !apps/docs/**
- libraries/**

jobs:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/eslint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@ on:
paths:
- package.json
- apps/**
- !apps/docs/**
- libraries/**

pull_request:
paths:
- package.json
- apps/**
- !apps/docs/**
- libraries/**

jobs:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,4 +169,4 @@ You can look at the other integration to understand what data to put inside.
And add the new provider to the list.
```typescript show.all.providers.tsx
{identifier: 'providerName', component: DefaultImportFromHighOrderProvider},
```
```
144 changes: 144 additions & 0 deletions apps/docs/installation/development.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
---
title: Development Environment
---

This is currently the recommended option to install Postiz in a supportable configuration. The docker images are in active and heavy development for now.

## Tested configurations

- MacOS
- Linux (Fedora 40)

Naturally you can use these instructions to setup a development environment on any platform, but there may not be much experience in the community to help you with any issues you may encounter.

## Prerequisites

This guide will ask you to install & configure several services exaplained below.

### Prerequisite Cloud Services

- **[Resend account](https://resend.com)** - for user activation and email notifications.
- **[Cloudflare R2](https://cloudfalre.com)** - for uploads (optional, can use local machine), and storing account data.
- **Social Media API details** - various API keys and secrets (more details later) for services you want to use; reddit, X, Instagram, etc..

### Prerequisite Local Services

- **Node.js** - for running the code! (version 18+)
- **PostgreSQL** - or any other SQL database (instructions beleow suggest Docker)
- **Redis** - for handling worker queues (instructions below suggest Docker)

We have some messages from users who are using Windows, which should work, but they are not tested well yet.

## Installation Instructions

### NodeJS (version 18+)

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

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

You can choose **Option A** to **Option B** to install the database.

#### Option A) Postgres and Redis as Single containers

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
```

#### Option B) Postgres and Redis as docker-compose

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 Terminal
docker compose -f "docker-compose.dev.yaml" up
```

## Build Postiz

<Steps>
<Step title="Clone the repository">
```bash Terminal
git clone https://github.com/gitroomhq/gitroom
```
</Step>

<Step title="Set environment variables">
Copy the `.env.example` file to `.env` and fill in the values

```bash .env
# Required Settings
DATABASE_URL="postgresql://postiz-user:postiz-password@localhost:5432/postiz-db-local"
REDIS_URL="redis://localhost:6379"
JWT_SECRET="random string for your JWT secret, make it long"
FRONTEND_URL="http://localhost:4200"
NEXT_PUBLIC_BACKEND_URL="http://localhost:3000"
BACKEND_INTERNAL_URL="http://localhost:3000"

# Social Media API Settings
X_API_KEY="Twitter API key for normal oAuth not oAuth2"
X_API_SECRET="Twitter API secret for normal oAuth not oAuth2"
LINKEDIN_CLIENT_ID="Linkedin Client ID"
LINKEDIN_CLIENT_SECRET="Linkedin Client Secret"
REDDIT_CLIENT_ID="Reddit Client ID"
REDDIT_CLIENT_SECRET="Linkedin Client Secret"
GITHUB_CLIENT_ID="GitHub Client ID"
GITHUB_CLIENT_SECRET="GitHub Client Secret"
RESEND_API_KEY="Resend API KEY"
UPLOAD_DIRECTORY="optional: your upload directory path if you host your files locally"
NEXT_PUBLIC_UPLOAD_STATIC_DIRECTORY="optional: your upload directory slug if you host your files locally"
CLOUDFLARE_ACCOUNT_ID="Cloudflare R2 Account ID"
CLOUDFLARE_ACCESS_KEY="Cloudflare R2 Access Key"
CLOUDFLARE_SECRET_ACCESS_KEY="Cloudflare R2 Secret Access Key"
CLOUDFLARE_BUCKETNAME="Cloudflare R2 Bucket Name"
CLOUDFLARE_BUCKET_URL="Cloudflare R2 Backet URL"

# Developer Settings
NX_ADD_PLUGINS=false
IS_GENERAL="true" # required for now
```

</Step>

<Step title="Install the dependencies">
```bash Terminal
npm install
```
</Step>

<Step title="Generate the prisma client and run the migrations">
```bash Terminal
npm run prisma-db-push
```
</Step>

<Step title="Run the project">
```bash Terminal
npm run dev
```
</Step>
</Steps>

If everything is running successfully, open http://localhost:4200 in your browser!

If everything is not running - you had errors in the steps above, please head over to our [support](/support) page.

## Next Steps

<CardGroup cols={2}>
<Card title="How it works" icon="screwdriver-wrench" href="/howitworks">
Learn the architecture of the project
</Card>
<Card title="Email notifications" icon="envelope" href="/emails">
Set up email for notifications
</Card>
<Card title="GitHub" icon="code-branch" href="/github">
Set up github for authentication and sync
</Card>
<Card title="Providers" icon="linkedin" href="/providers/x/x">
Set up providers such as Linkedin, X and Reddit
</Card>
</CardGroup>
69 changes: 69 additions & 0 deletions apps/docs/installation/docker-compose.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
---
title: Docker Compose
---

import EarlyDoc from '/snippets/earlydoc.mdx';
import DockerDatabase from '/snippets/docker-database.mdx';
import DockerEnvvarApps from '/snippets/docker-envvar-apps.mdx';

<EarlyDoc />
<DockerDatabase />

# Example `docker-compose.yml` file

```yaml
services:
postiz:
image: ghcr.io/gitroomhq/postiz-app:latest
container_name: postiz
restart: always
volumes:
- ./config:/config/ # Should contain your .env file
ports:
- 4200:4200
- 3000:3000
networks:
- postiz-network

postiz-postgres:
image: postgres:14.5
container_name: postiz-postgres
restart: always
environment:
POSTGRES_PASSWORD: postiz-local-pwd
POSTGRES_USER: postiz-local
POSTGRES_DB: postiz-db-local
volumes:
- postgres-volume:/var/lib/postgresql/data
ports:
- 5432:5432
networks:
- postiz-network
postiz-pg-admin:
image: dpage/pgadmin4
container_name: postiz-pg-admin
restart: always
ports:
- 8081:80
environment:
PGADMIN_DEFAULT_EMAIL: [email protected]
PGADMIN_DEFAULT_PASSWORD: admin
networks:
- postiz-network
postiz-redis:
image: redis:7.2
container_name: postiz-redis
restart: always
ports:
- 6379:6379

volumes:
postgres-volume:
external: false

networks:
postiz-network:
external: false
```
<DockerEnvvarApps />
20 changes: 20 additions & 0 deletions apps/docs/installation/docker.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
title: Docker
---

import EarlyDoc from '/snippets/earlydoc.mdx';
import DockerDatabase from '/snippets/docker-database.mdx';
import DockerEnvvarApps from '/snippets/docker-envvar-apps.mdx';

<EarlyDoc />

<DockerDatabase />


# Create the container on command line

```bash
docker create --name postiz -v ./config:/config -p 4200:4200 -p 3000:3000 ghcr.io/postiz/postiz:latest
```

<DockerEnvvarApps />
13 changes: 13 additions & 0 deletions apps/docs/installation/kubernetes-helm.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
title: Helm
---

import EarlyDoc from '/snippets/earlydoc.mdx';
import DockerDatabase from '/snippets/docker-database.mdx';

<EarlyDoc />
<DockerDatabase />

Postiz has a helm chart that is in very active development. You can find it here;

https://github.com/gitroomhq/postiz-helmchart
19 changes: 17 additions & 2 deletions apps/docs/mint.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,15 @@
"pages": [
"introduction",
"quickstart",
{
"group": "Install",
"pages": [
"installation/development",
"installation/docker",
"installation/docker-compose",
"installation/kubernetes-helm"
]
},
"howitworks",
"emails",
"github",
Expand All @@ -73,9 +82,15 @@
"providers/articles"
]
},
"providers/how-to-add-provider"
"support"
]
}
},
{
"group": "Developer Guide",
"pages": [
"developer-guide/how-to-add-provider"
]
}
],
"footerSocials": {
"twitter": "https://twitter.com/nevodavid",
Expand Down
Loading

0 comments on commit 74ae05f

Please sign in to comment.