Skip to content

Commit 8a972c5

Browse files
authored
Merge branch 'main' into add-env-for-mastodon
2 parents 7f2892e + 402878c commit 8a972c5

File tree

214 files changed

+38059
-56220
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

214 files changed

+38059
-56220
lines changed

.dockerignore

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,22 @@
22
# any half-built stuff in the build context as a pre-caution (also saves copying
33
# 180k files in node_modules that isn't used!).
44
**/node_modules
5+
node_modules/*
6+
node_modules
7+
docker-data/*
58
dist
69
.nx
10+
/apps/frontend/.next
11+
/apps/backend/dist
12+
/apps/workers/dist
13+
/apps/cron/dist
14+
/apps/commands/dist
715
.devcontainer
816
**/.git
9-
**/dist
1017
**/*.md
1118
**/LICENSE
1219
**/npm-debug.log
1320
**/*.vscode
21+
.git
22+
.github
23+
reports

.env.example

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Configuration reference: http://docs.postiz.com/configuration/reference
22

3-
# === Required Settings
3+
# === Required Settings
44
DATABASE_URL="postgresql://postiz-user:postiz-password@localhost:5432/postiz-db-local"
55
REDIS_URL="redis://localhost:6379"
66
JWT_SECRET="random string for your JWT secret, make it long"
@@ -20,7 +20,6 @@ CLOUDFLARE_BUCKETNAME="your-bucket-name"
2020
CLOUDFLARE_BUCKET_URL="https://your-bucket-url.r2.cloudflarestorage.com/"
2121
CLOUDFLARE_REGION="auto"
2222

23-
2423
# === Common optional Settings
2524

2625
## This is a dummy key, you must create your own from Resend.
@@ -32,15 +31,14 @@ CLOUDFLARE_REGION="auto"
3231
#DISABLE_REGISTRATION=false
3332

3433
# Where will social media icons be saved - local or cloudflare.
35-
STORAGE_PROVIDER="local"
34+
STORAGE_PROVIDER="local"
3635

3736
# Your upload directory path if you host your files locally, otherwise Cloudflare will be used.
3837
#UPLOAD_DIRECTORY=""
3938

4039
# Your upload directory path if you host your files locally, otherwise Cloudflare will be used.
4140
#NEXT_PUBLIC_UPLOAD_STATIC_DIRECTORY=""
4241

43-
4442
# Social Media API Settings
4543
X_API_KEY=""
4644
X_API_SECRET=""
@@ -81,6 +79,7 @@ OPENAI_API_KEY=""
8179
NEXT_PUBLIC_DISCORD_SUPPORT=""
8280
NEXT_PUBLIC_POLOTNO=""
8381
NOT_SECURED=false
82+
API_LIMIT=30 # The limit of the public API hour limit
8483

8584
# Payment settings
8685
FEE_AMOUNT=0.05
@@ -92,3 +91,18 @@ STRIPE_SIGNING_KEY_CONNECT=""
9291
# Developer Settings
9392
NX_ADD_PLUGINS=false
9493
IS_GENERAL="true" # required for now
94+
NEXT_PUBLIC_POSTIZ_OAUTH_DISPLAY_NAME="Authentik"
95+
NEXT_PUBLIC_POSTIZ_OAUTH_LOGO_URL="https://raw.githubusercontent.com/walkxcode/dashboard-icons/master/png/authentik.png"
96+
POSTIZ_GENERIC_OAUTH="false"
97+
POSTIZ_OAUTH_URL="https://auth.example.com"
98+
POSTIZ_OAUTH_AUTH_URL="https://auth.example.com/application/o/authorize"
99+
POSTIZ_OAUTH_TOKEN_URL="https://auth.example.com/application/o/token"
100+
POSTIZ_OAUTH_USERINFO_URL="https://authentik.example.com/application/o/userinfo"
101+
POSTIZ_OAUTH_CLIENT_ID=""
102+
POSTIZ_OAUTH_CLIENT_SECRET=""
103+
# POSTIZ_OAUTH_SCOPE="openid profile email" # default values
104+
105+
# Short Link Service Settings
106+
# DUB_TOKEN="" # Your self-hosted Dub API token
107+
# DUB_API_ENDPOINT="https://api.dub.co" # Your self-hosted Dub API endpoint
108+
# DUB_SHORT_LINK_DOMAIN="dub.sh" # Your self-hosted Dub domain

.eslintrc.json

Lines changed: 0 additions & 27 deletions
This file was deleted.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Build Extension
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
submit:
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- uses: actions/checkout@v4
12+
13+
- uses: pnpm/action-setup@v4
14+
15+
- uses: actions/setup-node@v4
16+
with:
17+
node-version: 20
18+
cache: 'pnpm'
19+
20+
- name: Install dependencies
21+
run: pnpm install
22+
23+
- name: Zip extensions
24+
run: FRONTEND_URL=https://platform.postiz.com pnpm run build:extension
25+
26+
- name: Upload to Nextcloud
27+
env:
28+
NEXTCLOUD_URL: ${{ secrets.NEXTCLOUD_URL }}
29+
NEXTCLOUD_USERNAME: ${{ secrets.NEXTCLOUD_USERNAME }}
30+
NEXTCLOUD_PASSWORD: ${{ secrets.NEXTCLOUD_PASSWORD }}
31+
run: |
32+
curl -T apps/extension/extension.zip \
33+
-u "$NEXTCLOUD_USERNAME:$NEXTCLOUD_PASSWORD" \
34+
"$NEXTCLOUD_URL/extension.zip"

.github/workflows/build.yaml

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ name: Build
33

44
on:
55
push:
6-
branches:
7-
- main
6+
pull_request:
87

98
jobs:
109
build:
@@ -21,20 +20,30 @@ jobs:
2120
uses: actions/setup-node@v4
2221
with:
2322
node-version: ${{ matrix.node-version }}
24-
cache: 'npm'
25-
cache-dependency-path: |
26-
**/package-lock.json
2723

28-
# https://nextjs.org/docs/pages/building-your-application/deploying/ci-build-caching#github-actions
29-
- uses: actions/cache@v4
24+
- name: Install pnpm
25+
uses: pnpm/action-setup@v2
26+
with:
27+
version: 8
28+
run_install: false
29+
30+
- name: Get pnpm store directory
31+
shell: bash
32+
run: |
33+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
34+
35+
- name: Setup pnpm cache
36+
uses: actions/cache@v4
3037
with:
3138
path: |
32-
~/.npm
39+
${{ env.STORE_PATH }}
3340
${{ github.workspace }}/.next/cache
34-
35-
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx') }}
41+
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}-${{ hashFiles('**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx') }}
3642
restore-keys: |
37-
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-
43+
${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}-
44+
45+
- name: Install dependencies
46+
run: pnpm install
3847

39-
- run: npm ci
40-
- run: npm run build
48+
- name: Build
49+
run: pnpm run build

.github/workflows/pr-docker-build renamed to .github/workflows/pr-docker-build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
uses: docker/login-action@v3
1919
with:
2020
registry: ghcr.io
21-
username: ${{ github.actor }}
21+
username: egelhaus
2222
password: ${{ github.token }}
2323

2424
- name: Set image tag
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Publish Extension
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
submit:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v4
11+
12+
- uses: pnpm/action-setup@v4
13+
14+
- uses: actions/setup-node@v4
15+
with:
16+
node-version: 20
17+
cache: 'pnpm'
18+
19+
- name: Install dependencies
20+
run: pnpm install
21+
22+
- name: Zip extensions
23+
run: FRONTEND_URL=https://platform.postiz.com pnpm run build:extension
24+
25+
- name: Publish to Chrome Web Store
26+
uses: mnao305/[email protected]
27+
with:
28+
extension-id: ${{ secrets.CHROME_EXTENSION_ID }}
29+
client-id: ${{ secrets.CHROME_CLIENT_ID }}
30+
client-secret: ${{ secrets.CHROME_CLIENT_SECRET }}
31+
refresh-token: ${{ secrets.CHROME_REFRESH_TOKEN }}
32+
file-path: apps/extension/extension.zip

.github/workflows/stale.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Close inactive issues
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
- cron: "*/30 * * * *"
7+
8+
jobs:
9+
close-issues:
10+
if: github.repository == 'gitroomhq/postiz-app'
11+
runs-on: ubuntu-latest
12+
permissions:
13+
issues: write
14+
pull-requests: write
15+
steps:
16+
- uses: actions/stale@v9
17+
with:
18+
days-before-issue-stale: 90
19+
days-before-issue-close: 7
20+
stale-issue-label: "stale"
21+
stale-issue-message: "This issue is stale because it has been open for 90 days with no activity."
22+
close-issue-message: "This issue was closed because it has been inactive for 7 days since being marked as stale."
23+
exempt-issue-labels: "no-stale-bot"
24+
25+
days-before-pr-stale: 90
26+
days-before-pr-close: 7
27+
stale-pr-label: "stale"
28+
stale-pr-message: "This PR is stale because it has been open for 90 days with no activity."
29+
close-pr-message: "This PR was closed because it has been inactive for 7 days since being marked as stale."
30+
exempt-pr-label: "no-stale-bot"
31+
32+
repo-token: ${{ secrets.GITHUB_TOKEN }}
33+
operations-per-run: 180

.npmrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
ignore-workspace-root-check=true
2+
node-linker=hoisted
3+
restrict-manifest-changes=true
4+
sync-injected-deps-after-scripts[]=build
5+
inject-workspace-packages=true

Dockerfile.dev

Lines changed: 11 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,19 @@
1-
# This Dockerfile is used for producing 3 container images.
2-
#
3-
# base - which is thrown away, that contains node and the basic infrastructure.
4-
# devcontainer - which is used for development, and contains the source code and the node_modules.
5-
# dist - which is used for production, and contains the built source code and the node_modules.
6-
7-
ARG NODE_VERSION="20.17"
8-
9-
# Base image
10-
FROM docker.io/node:${NODE_VERSION}-alpine3.19 AS base
11-
12-
## Just reduce unccessary noise in the logs.
13-
ENV NPM_CONFIG_UPDATE_NOTIFIER=false
14-
ENV NEXT_TELEMETRY_DISABLED=1
15-
16-
RUN apk add --no-cache \
17-
caddy \
18-
bash=5.2.21-r0 \
19-
supervisor=4.2.5-r4
1+
FROM node:20-alpine3.19
2+
RUN apk add --no-cache g++ make py3-pip supervisor bash caddy
3+
RUN npm --no-update-notifier --no-fund --global install [email protected] pm2
204

215
WORKDIR /app
226

23-
EXPOSE 3000
24-
EXPOSE 4200
25-
EXPOSE 5000
26-
27-
COPY var/docker/entrypoint.sh /app/entrypoint.sh
7+
COPY . /app
288
COPY var/docker/supervisord.conf /etc/supervisord.conf
29-
COPY var/docker/supervisord /app/supervisord_available_configs/
309
COPY var/docker/Caddyfile /app/Caddyfile
31-
COPY .env.example /config/postiz.env
32-
33-
VOLUME /config
34-
VOLUME /uploads
35-
36-
LABEL org.opencontainers.image.source=https://github.com/gitroomhq/postiz-app
37-
38-
ENTRYPOINT ["/app/entrypoint.sh"]
39-
40-
# Builder image
41-
FROM base AS devcontainer
42-
43-
RUN apk add --no-cache \
44-
pkgconfig \
45-
gcc \
46-
pixman-dev \
47-
cairo-dev \
48-
pango-dev \
49-
make \
50-
build-base
51-
52-
COPY nx.json tsconfig.base.json package.json package-lock.json build.plugins.js /app/
53-
COPY apps /app/apps/
54-
COPY libraries /app/libraries/
55-
56-
RUN npm ci --no-fund && npx nx run-many --target=build --projects=frontend,backend,workers,cron
57-
58-
VOLUME /config
59-
VOLUME /uploads
60-
61-
LABEL org.opencontainers.image.title="Postiz App (DevContainer)"
62-
63-
# Output image
64-
FROM base AS dist
65-
66-
COPY --from=devcontainer /app/node_modules/ /app/node_modules/
67-
COPY --from=devcontainer /app/dist/ /app/dist/
68-
69-
# Required for prisma
70-
COPY --from=devcontainer /app/libraries/ /app/libraries/
10+
COPY var/docker/entrypoint.sh /app/entrypoint.sh
11+
COPY var/docker/supervisord/caddy.conf /etc/supervisor.d/caddy.conf
12+
RUN chmod +x /app/entrypoint.sh
7113

72-
COPY package.json nx.json /app/
14+
RUN pnpm install
15+
RUN pnpm run build
7316

74-
VOLUME /config
75-
VOLUME /uploads
17+
EXPOSE 4200
7618

77-
## Labels at the bottom, because CI will eventually add dates, commit hashes, etc.
78-
LABEL org.opencontainers.image.title="Postiz App (Production)"
19+
CMD ["pnpm", "run", "pm2"]

0 commit comments

Comments
 (0)