Skip to content

Commit

Permalink
Merge branch 'main' into profile-settings-modal-loading-state
Browse files Browse the repository at this point in the history
  • Loading branch information
madhav-relish authored Sep 10, 2024
2 parents a6dc105 + 305115e commit 9bc6913
Show file tree
Hide file tree
Showing 162 changed files with 2,573 additions and 1,386 deletions.
14 changes: 14 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "Postiz Dev Container",
"image": "localhost/postiz-devcontainer",
"features": {},
"customizations": {
"vscode": {
"settings": {},
"extensions": []
}
},
"forwardPorts": ["4200:4200", "3000:3000"],
"mounts": ["source=/apps,destination=/apps/dist/,type=bind,consistency=cached"]
}

9 changes: 9 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# We want the docker builds to be clean, and as fast as possible. Don't send
# any half-built stuff in the build context as a pre-caution (also saves copying
# 180k files in node_modules that isn't used!).
node_modules
dist
.nx
.devcontainer
.git
*.md
73 changes: 45 additions & 28 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,34 +1,51 @@
DATABASE_URL="postgres://<user>:<password>@<host>:<port>/<database_name>"
REDIS_URL="redis://<host>:<port>"
UPLOAD_DIRECTORY=
NEXT_PUBLIC_UPLOAD_STATIC_DIRECTORY=
JWT_SECRET=
FRONTEND_URL=
NEXT_PUBLIC_BACKEND_URL=
BACKEND_INTERNAL_URL=
X_API_KEY=
X_API_SECRET=
LINKEDIN_CLIENT_ID=
LINKEDIN_CLIENT_SECRET=
REDDIT_CLIENT_ID=
REDDIT_CLIENT_SECRET=
GITHUB_CLIENT_ID=
GITHUB_CLIENT_SECRET=
RESEND_API_KEY=
BEEHIIVE_API_KEY=
BEEHIIVE_PUBLICATION_ID=
NX_ADD_PLUGINS=
CLOUDFLARE_ACCOUNT_ID=
CLOUDFLARE_ACCESS_KEY=
CLOUDFLARE_SECRET_ACCESS_KEY=
CLOUDFLARE_BUCKETNAME=
CLOUDFLARE_BUCKET_URL=
CLOUDFLARE_REGION=
FEE_AMOUNT=
DATABASE_URL=""
REDIS_URL=""
UPLOAD_DIRECTORY=""
NEXT_PUBLIC_UPLOAD_STATIC_DIRECTORY=""
STRIPE_PUBLISHABLE_KEY=""
STRIPE_SECRET_KEY=""
STRIPE_SIGNING_KEY=""
JWT_SECRET=""
FRONTEND_URL=""
MAIN_URL=""
NEXT_PUBLIC_BACKEND_URL=""
BACKEND_INTERNAL_URL=""
X_API_KEY=""
X_API_SECRET=""
X_CLIENT=""
X_SECRET=""
LINKEDIN_CLIENT_ID=""
LINKEDIN_CLIENT_SECRET=""
REDDIT_CLIENT_ID=""
REDDIT_CLIENT_SECRET=""
GITHUB_CLIENT_ID=""
GITHUB_CLIENT_SECRET=""
RESEND_API_KEY=""
BEEHIIVE_API_KEY=""
BEEHIIVE_PUBLICATION_ID=""
NX_ADD_PLUGINS=false
CLOUDFLARE_ACCOUNT_ID=""
CLOUDFLARE_ACCESS_KEY=""
CLOUDFLARE_SECRET_ACCESS_KEY=""
CLOUDFLARE_BUCKETNAME=""
CLOUDFLARE_BUCKET_URL=""
CLOUDFLARE_REGION=""
FEE_AMOUNT=0.05
OPENAI_API_KEY=""
NEXT_PUBLIC_DISCORD_SUPPORT=""
THREADS_APP_ID=""
THREADS_APP_SECRET=""
FACEBOOK_APP_ID=""
FACEBOOK_APP_SECRET=""
YOUTUBE_CLIENT_ID=""
YOUTUBE_CLIENT_SECRET=""
TIKTOK_CLIENT_ID=""
TIKTOK_CLIENT_SECRET=""
TIKTOK_CLIENT_SECRET=""
PINTEREST_CLIENT_ID=""
PINTEREST_CLIENT_SECRET=""
DRIBBBLE_CLIENT_ID=""
DRIBBBLE_CLIENT_SECRET=""
IS_GENERAL="true"
EMAIL_FROM_ADDRESS=""
EMAIL_FROM_NAME=""
NEXT_PUBLIC_POLOTNO="Polotno key for the gallery"
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: "🐛 Bug Report"
description: "Submit a bug report to help us improve"
description: "Submit a bug report to help us improve,\nif you have a problem installing the app please join our https://discord.postiz.com instead for help."
title: "🐛 Bug Report: "
labels: ["type: bug"]
body:
Expand Down
39 changes: 39 additions & 0 deletions .github/workflows/build-containers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
name: "Build Containers"

on:
workflow_dispatch:
push:
tags:
- '*'

jobs:
build-tag:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Login to ghcr
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}

- name: docker build
run: ./var/docker/docker-build.sh

- name: Get date
run: |
echo "DATE=$(date +'%s')" >> "$GITHUB_ENV"
- name: docker tag
run: |
docker tag localhost/postiz ghcr.io/githubhq/postiz-app:${{ env.DATE }}
docker push ghcr.io/githubhq/postiz-app:${{ env.DATE }}
docker tag localhost/postiz-devcontainer ghcr.io/githubhq/postiz-app:${{ env.DATE }}
docker push ghcr.io/githubhq/postiz-devcontainer:${{ env.DATE }}
50 changes: 50 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
---
name: Build

on:
push:
branches:
- main
paths:
- package.json
- apps/**
- libraries/**

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

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: ['20.17.0']
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
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
45 changes: 45 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
name: "Code Quality Analysis"

on:
push:
branches:
- main
paths:
- apps/**
- libraries/**

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

jobs:
analyze:
name: Analyze (${{ matrix.language }})

runs-on: 'ubuntu-latest'
permissions:
security-events: write

strategy:
fail-fast: false
matrix:
include:
- language: javascript-typescript
build-mode: none

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"
58 changes: 58 additions & 0 deletions .github/workflows/eslint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
---
name: ESLint

on:
push:
branches:
- main
paths:
- package.json
- apps/**
- libraries/**

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

jobs:
eslint:
name: Run eslint scanning
runs-on: ubuntu-latest
permissions:
contents: read
security-events: write
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
strategy:
matrix:
service: ["backend", "frontend"]
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup node
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: |
**/package-lock.json
- name: Install ESLint
run: |
npm install eslint
npm install @microsoft/[email protected]
- name: Run ESLint
run: npx eslint apps/${{ matrix.service }}/
--config apps/${{ matrix.service }}/.eslintrc.json
--format @microsoft/eslint-formatter-sarif
--output-file apps/${{ matrix.service }}/eslint-results.sarif
continue-on-error: true

- name: Upload analysis results to GitHub
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: apps/${{ matrix.service }}/eslint-results.sarif
wait-for-processing: true
58 changes: 58 additions & 0 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# This Dockerfile is used for producing 3 container images.
#
# base - which is thrown away, that contains node and the basic infrastructure.
# devcontainer - which is used for development, and contains the source code and the node_modules.
# dist - which is used for production, and contains the built source code and the node_modules.

ARG NODE_VERSION="20.17"

# Base image
FROM docker.io/node:${NODE_VERSION}-alpine3.19 AS base

## Just reduce unccessary noise in the logs.
ENV NPM_CONFIG_UPDATE_NOTIFIER=false
ENV NEXT_TELEMETRY_DISABLED=1

RUN apk add --no-cache \
bash=5.2.21-r0 \
supervisor=4.2.5-r4 \
make \
build-base

WORKDIR /app

EXPOSE 4200
EXPOSE 3000

COPY var/docker/entrypoint.sh /app/entrypoint.sh
COPY var/docker/supervisord.conf /etc/supervisord.conf
COPY var/docker/supervisord /app/supervisord_available_configs/
COPY .env.example /config/.env

VOLUME /config

LABEL org.opencontainers.image.source=https://github.com/gitroomhq/postiz-app

ENTRYPOINT ["/app/entrypoint.sh"]

# Builder image
FROM base AS devcontainer

COPY nx.json tsconfig.base.json package.json package-lock.json /app/
COPY apps /app/apps/
COPY libraries /app/libraries/

RUN npm ci --no-fund && npx nx run-many --target=build --projects=frontend,backend,workers,cron

LABEL org.opencontainers.image.title="Postiz App (DevContainer)"

# Output image
FROM base AS dist

COPY --from=devcontainer /app/node_modules/ /app/node_modules/
COPY --from=devcontainer /app/dist/ /app/dist/

COPY package.json nx.json /app/

## Labels at the bottom, because CI will eventually add dates, commit hashes, etc.
LABEL org.opencontainers.image.title="Postiz App (Production)"
Loading

0 comments on commit 9bc6913

Please sign in to comment.