fix: docker setup (#987)

* removing dependencies from .env

* dev: Passing the arguments from docker compose to DockerWeb in nextjs to define base environment variables

* dev: removed env from docker-compose and taking the env from shell

* dev: Updated docker file and used console in signin to test the env from docker

* dev: Docker setting env variables via shell

* removed env variables and args

* Update Dockerfile.web

* Update Dockerfile.web

* Update signin.tsx

* .

* .

* dev: Added BASE_URL from docker

* dev: Updated docker config

* dev: scripts for replacing variable during runtime

* dev: entrypoint script

* dev: update replace env script and update docker entrypoint command for frontend

* dev: update replace env script to not update process.env

* dev: update docker file to add missing variables as well

* fix: updated docker compose yml and web

* dev: create start script to run docker and update script for replacing variables

* dev: update setup script and env example script to create variables in the root of the project

* .

* dev: update docker compose hub

* dev: update docker compose hub command

* dev: update docker compose yml and env example

* dev: update docker compose hub

* dev: single docker

---------

Co-authored-by: Narayana <narayana.vadapalli1996@gmail.com>
Co-authored-by: gurusainath <gurusainath007@gmail.com>
This commit is contained in:
pablohashescobar 2023-05-03 13:36:55 +05:30 committed by GitHub
parent e3d43298df
commit c7f1090914
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 266 additions and 80 deletions

View File

@ -1,5 +1,4 @@
# Replace with your instance Public IP # Replace with your instance Public IP
# NEXT_PUBLIC_API_BASE_URL = "http://localhost"
NEXT_PUBLIC_EXTRA_IMAGE_DOMAINS= NEXT_PUBLIC_EXTRA_IMAGE_DOMAINS=
NEXT_PUBLIC_GOOGLE_CLIENTID="" NEXT_PUBLIC_GOOGLE_CLIENTID=""
NEXT_PUBLIC_GITHUB_APP_NAME="" NEXT_PUBLIC_GITHUB_APP_NAME=""
@ -10,3 +9,12 @@ NEXT_PUBLIC_ENABLE_SENTRY=0
NEXT_PUBLIC_ENABLE_SESSION_RECORDER=0 NEXT_PUBLIC_ENABLE_SESSION_RECORDER=0
NEXT_PUBLIC_TRACK_EVENTS=0 NEXT_PUBLIC_TRACK_EVENTS=0
NEXT_PUBLIC_SLACK_CLIENT_ID="" NEXT_PUBLIC_SLACK_CLIENT_ID=""
EMAIL_HOST=""
EMAIL_HOST_USER=""
EMAIL_HOST_PASSWORD=""
AWS_REGION=""
AWS_ACCESS_KEY_ID=""
AWS_SECRET_ACCESS_KEY=""
AWS_S3_BUCKET_NAME=""
OPENAI_API_KEY=""
GPT_ENGINE=""

View File

@ -1,4 +1,4 @@
name: Build Api Server Docker Image name: Build and Push Backend Docker Image
on: on:
push: push:
@ -10,11 +10,8 @@ on:
jobs: jobs:
build_push_backend: build_push_backend:
name: Build Api Server Docker Image name: Build and Push Api Server Docker Image
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
permissions:
contents: read
packages: write
steps: steps:
- name: Check out the repo - name: Check out the repo
@ -28,20 +25,33 @@ jobs:
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2.5.0 uses: docker/setup-buildx-action@v2.5.0
- name: Login to Github Container Registry - name: Login to GitHub Container Registry
uses: docker/login-action@v2.1.0 uses: docker/login-action@v2.1.0
with: with:
registry: "ghcr.io" registry: "ghcr.io"
username: ${{ github.actor }} username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }} password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker - name: Login to Docker Hub
id: meta uses: docker/login-action@v2.1.0
with:
registry: "registry.hub.docker.com"
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Extract metadata (tags, labels) for Docker (Docker Hub)
id: ghmeta
uses: docker/metadata-action@v4.3.0
with:
images: makeplane/plane-backend
- name: Extract metadata (tags, labels) for Docker (Github)
id: dkrmeta
uses: docker/metadata-action@v4.3.0 uses: docker/metadata-action@v4.3.0
with: with:
images: ghcr.io/${{ github.repository }}-backend images: ghcr.io/${{ github.repository }}-backend
- name: Build Api Server - name: Build and Push to GitHub Container Registry
uses: docker/build-push-action@v4.0.0 uses: docker/build-push-action@v4.0.0
with: with:
context: ./apiserver context: ./apiserver
@ -50,5 +60,18 @@ jobs:
push: true push: true
cache-from: type=gha cache-from: type=gha
cache-to: type=gha cache-to: type=gha
tags: ${{ steps.meta.outputs.tags }} tags: ${{ steps.ghmeta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }} labels: ${{ steps.ghmeta.outputs.labels }}
- name: Build and Push to Docker Hub
uses: docker/build-push-action@v4.0.0
with:
context: ./apiserver
file: ./apiserver/Dockerfile.api
platforms: linux/arm64,linux/amd64
push: true
cache-from: type=gha
cache-to: type=gha
tags: ${{ steps.dkrmeta.outputs.tags }}
labels: ${{ steps.dkrmeta.outputs.labels }}

View File

@ -1,4 +1,4 @@
name: Build Frontend Docker Image name: Build and Push Frontend Docker Image
on: on:
push: push:
@ -12,9 +12,6 @@ jobs:
build_push_frontend: build_push_frontend:
name: Build Frontend Docker Image name: Build Frontend Docker Image
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
permissions:
contents: read
packages: write
steps: steps:
- name: Check out the repo - name: Check out the repo
@ -35,13 +32,26 @@ jobs:
username: ${{ github.actor }} username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }} password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker - name: Login to Docker Hub
uses: docker/login-action@v2.1.0
with:
registry: "registry.hub.docker.com"
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Extract metadata (tags, labels) for Docker (Docker Hub)
id: ghmeta
uses: docker/metadata-action@v4.3.0
with:
images: makeplane/plane-frontend
- name: Extract metadata (tags, labels) for Docker (Github)
id: meta id: meta
uses: docker/metadata-action@v4.3.0 uses: docker/metadata-action@v4.3.0
with: with:
images: ghcr.io/${{ github.repository }}-frontend images: ghcr.io/${{ github.repository }}-frontend
- name: Build Frontend Server - name: Build and Push to GitHub Container Registry
uses: docker/build-push-action@v4.0.0 uses: docker/build-push-action@v4.0.0
with: with:
context: . context: .
@ -50,5 +60,18 @@ jobs:
push: true push: true
cache-from: type=gha cache-from: type=gha
cache-to: type=gha cache-to: type=gha
tags: ${{ steps.meta.outputs.tags }} tags: ${{ steps.ghmeta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }} labels: ${{ steps.ghmeta.outputs.labels }}
- name: Build and Push to Docker Container Registry
uses: docker/build-push-action@v4.0.0
with:
context: .
file: ./apps/app/Dockerfile.web
platforms: linux/arm64,linux/amd64
push: true
cache-from: type=gha
cache-to: type=gha
tags: ${{ steps.dkrmeta.outputs.tags }}
labels: ${{ steps.dkrmeta.outputs.labels }}

View File

@ -3,6 +3,7 @@ RUN apk add --no-cache libc6-compat
RUN apk update RUN apk update
# Set working directory # Set working directory
WORKDIR /app WORKDIR /app
ENV NEXT_PUBLIC_API_BASE_URL=http://NEXT_PUBLIC_API_BASE_URL_PLACEHOLDER
RUN yarn global add turbo RUN yarn global add turbo
COPY . . COPY . .
@ -16,7 +17,7 @@ FROM node:18-alpine AS installer
RUN apk add --no-cache libc6-compat RUN apk add --no-cache libc6-compat
RUN apk update RUN apk update
WORKDIR /app WORKDIR /app
ARG NEXT_PUBLIC_API_BASE_URL=http://localhost:8000
# First install the dependencies (as they change less often) # First install the dependencies (as they change less often)
COPY .gitignore .gitignore COPY .gitignore .gitignore
COPY --from=builder /app/out/json/ . COPY --from=builder /app/out/json/ .
@ -26,9 +27,16 @@ RUN yarn install
# Build the project # Build the project
COPY --from=builder /app/out/full/ . COPY --from=builder /app/out/full/ .
COPY turbo.json turbo.json COPY turbo.json turbo.json
COPY replace-env-vars.sh /usr/local/bin/
USER root
RUN chmod +x /usr/local/bin/replace-env-vars.sh
RUN yarn turbo run build --filter=app RUN yarn turbo run build --filter=app
ENV NEXT_PUBLIC_API_BASE_URL=$NEXT_PUBLIC_API_BASE_URL \
BUILT_NEXT_PUBLIC_API_BASE_URL=$NEXT_PUBLIC_API_BASE_URL
RUN /usr/local/bin/replace-env-vars.sh http://NEXT_PUBLIC_WEBAPP_URL_PLACEHOLDER ${NEXT_PUBLIC_WEBAPP_URL}
FROM python:3.11.1-alpine3.17 AS backend FROM python:3.11.1-alpine3.17 AS backend
@ -108,6 +116,16 @@ COPY nginx/nginx-single-docker-image.conf /etc/nginx/http.d/default.conf
COPY nginx/supervisor.conf /code/supervisor.conf COPY nginx/supervisor.conf /code/supervisor.conf
ARG NEXT_PUBLIC_API_BASE_URL=http://localhost:8000
ENV NEXT_PUBLIC_API_BASE_URL=$NEXT_PUBLIC_API_BASE_URL \
BUILT_NEXT_PUBLIC_API_BASE_URL=$NEXT_PUBLIC_API_BASE_URL
USER root
COPY replace-env-vars.sh /usr/local/bin/
COPY start.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/replace-env-vars.sh
RUN chmod +x /usr/local/bin/start.sh
CMD ["supervisord","-c","/code/supervisor.conf"] CMD ["supervisord","-c","/code/supervisor.conf"]

View File

@ -1,28 +0,0 @@
DJANGO_SETTINGS_MODULE="plane.settings.production"
# Database
DATABASE_URL=postgres://plane:xyzzyspoon@db:5432/plane
# Cache
REDIS_URL=redis://redis:6379/
# SMTP
EMAIL_HOST=""
EMAIL_HOST_USER=""
EMAIL_HOST_PASSWORD=""
EMAIL_PORT="587"
EMAIL_USE_TLS="1"
EMAIL_FROM="Team Plane <team@mailer.plane.so>"
# AWS
AWS_REGION=""
AWS_ACCESS_KEY_ID=""
AWS_SECRET_ACCESS_KEY=""
AWS_S3_BUCKET_NAME=""
AWS_S3_ENDPOINT_URL=""
# FE
WEB_URL="localhost/"
# OAUTH
GITHUB_CLIENT_SECRET=""
# Flags
DISABLE_COLLECTSTATIC=1
DOCKERIZED=1
# GPT Envs
OPENAI_API_KEY=0
GPT_ENGINE=0

View File

@ -3,6 +3,7 @@ RUN apk add --no-cache libc6-compat
RUN apk update RUN apk update
# Set working directory # Set working directory
WORKDIR /app WORKDIR /app
ENV NEXT_PUBLIC_API_BASE_URL=http://NEXT_PUBLIC_API_BASE_URL_PLACEHOLDER
RUN yarn global add turbo RUN yarn global add turbo
COPY . . COPY . .
@ -12,10 +13,10 @@ RUN turbo prune --scope=app --docker
# Add lockfile and package.json's of isolated subworkspace # Add lockfile and package.json's of isolated subworkspace
FROM node:18-alpine AS installer FROM node:18-alpine AS installer
RUN apk add --no-cache libc6-compat RUN apk add --no-cache libc6-compat
RUN apk update RUN apk update
WORKDIR /app WORKDIR /app
ARG NEXT_PUBLIC_API_BASE_URL=http://localhost:8000
# First install the dependencies (as they change less often) # First install the dependencies (as they change less often)
COPY .gitignore .gitignore COPY .gitignore .gitignore
@ -26,9 +27,17 @@ RUN yarn install
# Build the project # Build the project
COPY --from=builder /app/out/full/ . COPY --from=builder /app/out/full/ .
COPY turbo.json turbo.json COPY turbo.json turbo.json
COPY replace-env-vars.sh /usr/local/bin/
USER root
RUN chmod +x /usr/local/bin/replace-env-vars.sh
RUN yarn turbo run build --filter=app RUN yarn turbo run build --filter=app
ENV NEXT_PUBLIC_API_BASE_URL=$NEXT_PUBLIC_API_BASE_URL \
BUILT_NEXT_PUBLIC_API_BASE_URL=$NEXT_PUBLIC_API_BASE_URL
RUN /usr/local/bin/replace-env-vars.sh http://NEXT_PUBLIC_WEBAPP_URL_PLACEHOLDER ${NEXT_PUBLIC_WEBAPP_URL}
FROM node:18-alpine AS runner FROM node:18-alpine AS runner
WORKDIR /app WORKDIR /app
@ -43,8 +52,20 @@ COPY --from=installer /app/apps/app/package.json .
# Automatically leverage output traces to reduce image size # Automatically leverage output traces to reduce image size
# https://nextjs.org/docs/advanced-features/output-file-tracing # https://nextjs.org/docs/advanced-features/output-file-tracing
COPY --from=installer --chown=captain:plane /app/apps/app/.next/standalone ./ COPY --from=installer --chown=captain:plane /app/apps/app/.next/standalone ./
# COPY --from=installer --chown=captain:plane /app/apps/app/.next/standalone/node_modules ./apps/app/node_modules
COPY --from=installer --chown=captain:plane /app/apps/app/.next/static ./apps/app/.next/static COPY --from=installer --chown=captain:plane /app/apps/app/.next ./apps/app/.next
ARG NEXT_PUBLIC_API_BASE_URL=http://localhost:8000
ENV NEXT_PUBLIC_API_BASE_URL=$NEXT_PUBLIC_API_BASE_URL \
BUILT_NEXT_PUBLIC_API_BASE_URL=$NEXT_PUBLIC_API_BASE_URL
USER root
COPY replace-env-vars.sh /usr/local/bin/
COPY start.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/replace-env-vars.sh
RUN chmod +x /usr/local/bin/start.sh
USER captain
ENV NEXT_TELEMETRY_DISABLED 1 ENV NEXT_TELEMETRY_DISABLED 1

View File

@ -1,6 +1,10 @@
require("dotenv").config({ path: ".env" });
const { withSentryConfig } = require("@sentry/nextjs"); const { withSentryConfig } = require("@sentry/nextjs");
const path = require("path"); const path = require("path");
const extraImageDomains = (process.env.NEXT_PUBLIC_EXTRA_IMAGE_DOMAINS ?? "").split(",").filter((domain) => domain.length > 0); const extraImageDomains = (process.env.NEXT_PUBLIC_EXTRA_IMAGE_DOMAINS ?? "")
.split(",")
.filter((domain) => domain.length > 0);
const nextConfig = { const nextConfig = {
reactStrictMode: false, reactStrictMode: false,

View File

@ -23,6 +23,7 @@
"@types/react-datepicker": "^4.8.0", "@types/react-datepicker": "^4.8.0",
"axios": "^1.1.3", "axios": "^1.1.3",
"cmdk": "^0.2.0", "cmdk": "^0.2.0",
"dotenv": "^16.0.3",
"js-cookie": "^3.0.1", "js-cookie": "^3.0.1",
"lodash.debounce": "^4.0.8", "lodash.debounce": "^4.0.8",
"next": "12.3.2", "next": "12.3.2",

View File

@ -1,8 +1,6 @@
import React, { useCallback, useState } from "react"; import React, { useCallback, useState } from "react";
import { useRouter } from "next/router"; import { useRouter } from "next/router";
import Image from "next/image"; import Image from "next/image";
// hooks // hooks
import useUser from "hooks/use-user"; import useUser from "hooks/use-user";
import useToast from "hooks/use-toast"; import useToast from "hooks/use-toast";

View File

@ -35,24 +35,46 @@ services:
- redisdata:/data - redisdata:/data
plane-web: plane-web:
container_name: planefrontend container_name: planefrontend
image: makeplane/plane-frontend:0.5-dev image: makeplane/plane-frontend:0.6
restart: always restart: always
command: node apps/app/server.js command: [ "/usr/local/bin/start.sh" ]
env_file: environment:
- ./apps/app/.env NEXT_PUBLIC_API_BASE_URL: ${NEXT_PUBLIC_API_BASE_URL}
NEXT_PUBLIC_GOOGLE_CLIENTID: 0
NEXT_PUBLIC_GITHUB_APP_NAME: 0
NEXT_PUBLIC_GITHUB_ID: 0
NEXT_PUBLIC_SENTRY_DSN: 0
NEXT_PUBLIC_ENABLE_OAUTH: 0
NEXT_PUBLIC_ENABLE_SENTRY: 0
ports: ports:
- 3000:3000 - 3000:3000
plane-api: plane-api:
container_name: planebackend container_name: planebackend
image: makeplane/plane-backend:0.5-dev image: makeplane/plane-backend:0.6
build: build:
context: ./apiserver context: ./apiserver
dockerfile: Dockerfile.api dockerfile: Dockerfile.api
restart: always restart: always
ports: ports:
- 8000:8000 - 8000:8000
env_file: environment:
- ./apiserver/.env DJANGO_SETTINGS_MODULE: plane.settings.production
DATABASE_URL: postgres://plane:xyzzyspoon@db:5432/plane
REDIS_URL: redis://redis:6379/
EMAIL_HOST: ${EMAIL_HOST}
EMAIL_HOST_USER: ${EMAIL_HOST_USER}
EMAIL_HOST_PASSWORD: ${EMAIL_HOST_PASSWORD}
AWS_REGION: ${AWS_REGION}
AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID}
AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY}
AWS_S3_BUCKET_NAME: ${AWS_S3_BUCKET_NAME}
WEB_URL: localhost/
GITHUB_CLIENT_SECRET: ${GITHUB_CLIENT_SECRET}
DISABLE_COLLECTSTATIC: 1
DOCKERIZED: 1
OPENAI_API_KEY: 0
GPT_ENGINE: 0
SECRET_KEY: ${SECRET_KEY}
depends_on: depends_on:
- db - db
- redis - redis
@ -62,7 +84,7 @@ services:
- redis:redis - redis:redis
plane-worker: plane-worker:
container_name: planerqworker container_name: planerqworker
image: makeplane/plane-worker:0.5-dev image: makeplane/plane-worker:0.6
depends_on: depends_on:
- redis - redis
- db - db
@ -71,8 +93,24 @@ services:
links: links:
- redis:redis - redis:redis
- db:db - db:db
env_file: environment:
- ./apiserver/.env DJANGO_SETTINGS_MODULE: plane.settings.production
DATABASE_URL: postgres://plane:xyzzyspoon@db:5432/plane
REDIS_URL: redis://redis:6379/
EMAIL_HOST: ${EMAIL_HOST}
EMAIL_HOST_USER: ${EMAIL_HOST_USER}
EMAIL_HOST_PASSWORD: ${EMAIL_HOST_PASSWORD}
AWS_REGION: ${AWS_REGION}
AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID}
AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY}
AWS_S3_BUCKET_NAME: ${AWS_S3_BUCKET_NAME}
WEB_URL: localhost/
GITHUB_CLIENT_SECRET: ${GITHUB_CLIENT_SECRET}
DISABLE_COLLECTSTATIC: 1
DOCKERIZED: 1
OPENAI_API_KEY: 0
GPT_ENGINE: 0
SECRET_KEY: ${SECRET_KEY}
volumes: volumes:
pgdata: pgdata:
redisdata: redisdata:

View File

@ -38,12 +38,21 @@ services:
build: build:
context: . context: .
dockerfile: ./apps/app/Dockerfile.web dockerfile: ./apps/app/Dockerfile.web
restart: always args:
command: node apps/app/server.js NEXT_PUBLIC_API_BASE_URL: http://localhost:8000
env_file: command: [ "/usr/local/bin/start.sh" ]
- ./apps/app/.env
ports: ports:
- 3000:3000 - 3000:3000
environment:
NEXT_PUBLIC_API_BASE_URL: http://localhost1234
NEXT_PUBLIC_GOOGLE_CLIENTID: "0"
NEXT_PUBLIC_GITHUB_APP_NAME: "0"
NEXT_PUBLIC_GITHUB_ID: "0"
NEXT_PUBLIC_SENTRY_DSN: "0"
NEXT_PUBLIC_ENABLE_OAUTH: "0"
NEXT_PUBLIC_ENABLE_SENTRY: "0"
NEXT_PUBLIC_ENABLE_SESSION_RECORDER: "0"
NEXT_PUBLIC_TRACK_EVENTS: "0"
plane-api: plane-api:
container_name: planebackend container_name: planebackend
build: build:
@ -52,8 +61,24 @@ services:
restart: always restart: always
ports: ports:
- 8000:8000 - 8000:8000
env_file: environment:
- ./apiserver/.env DJANGO_SETTINGS_MODULE: plane.settings.production
DATABASE_URL: postgres://plane:xyzzyspoon@db:5432/plane
REDIS_URL: redis://redis:6379/
EMAIL_HOST:
EMAIL_HOST_USER:
EMAIL_HOST_PASSWORD:
AWS_REGION:
AWS_ACCESS_KEY_ID:
AWS_SECRET_ACCESS_KEY:
AWS_S3_BUCKET_NAME:
WEB_URL: localhost/
GITHUB_CLIENT_SECRET:
DISABLE_COLLECTSTATIC: 1
DOCKERIZED: 1
OPENAI_API_KEY: 0
GPT_ENGINE: 0
SECRET_KEY: ${SECRET_KEY}
depends_on: depends_on:
- db - db
- redis - redis
@ -74,8 +99,24 @@ services:
links: links:
- redis:redis - redis:redis
- db:db - db:db
env_file: environment:
- ./apiserver/.env DJANGO_SETTINGS_MODULE: plane.settings.production
DATABASE_URL: postgres://plane:xyzzyspoon@db:5432/plane
REDIS_URL: redis://redis:6379/
EMAIL_HOST:
EMAIL_HOST_USER:
EMAIL_HOST_PASSWORD:
AWS_REGION:
AWS_ACCESS_KEY_ID:
AWS_SECRET_ACCESS_KEY:
AWS_S3_BUCKET_NAME:
WEB_URL: localhost/
GITHUB_CLIENT_SECRET:
DISABLE_COLLECTSTATIC: 1
DOCKERIZED: 1
OPENAI_API_KEY: 0
GPT_ENGINE: 0
SECRET_KEY: asdasdasdsd
volumes: volumes:
pgdata: pgdata:
redisdata: redisdata:

View File

@ -2,7 +2,7 @@
nodaemon=true nodaemon=true
[program:node] [program:node]
command=node /app/apps/app/server.js command=sh /usr/local/bin/start.sh
autostart=true autostart=true
autorestart=true autorestart=true
stderr_logfile=/var/log/node.err.log stderr_logfile=/var/log/node.err.log
@ -21,4 +21,12 @@ command=nginx -g "daemon off;"
autostart=true autostart=true
autorestart=true autorestart=true
stderr_logfile=/var/log/nginx.err.log stderr_logfile=/var/log/nginx.err.log
stdout_logfile=/var/log/nginx.out.log stdout_logfile=/var/log/nginx.out.log
[program:worker]
directory=/code
command=sh bin/worker
autostart=true
autorestart=true
stderr_logfile=/var/log/worker.err.log
stdout_logfile=/var/log/worker.out.log

17
replace-env-vars.sh Normal file
View File

@ -0,0 +1,17 @@
#!/bin/sh
FROM=$1
TO=$2
if [ "${FROM}" = "${TO}" ]; then
echo "Nothing to replace, the value is already set to ${TO}."
exit 0
fi
# Only peform action if $FROM and $TO are different.
echo "Replacing all statically built instances of $FROM with this string $TO ."
find apps/app/.next -type f |
while read file; do
sed -i "s|$FROM|$TO|g" "$file"
done

View File

@ -1,9 +1,7 @@
#!/bin/bash #!/bin/bash
cp ./apiserver/.env.example ./apiserver/.env cp ./.env.example ./.env
# Generating App environmental variables
cp ./apps/app/.env.example ./apps/app/.env
echo -e "\nNEXT_PUBLIC_API_BASE_URL=http://$1" >> ./apps/app/.env echo -e "\nNEXT_PUBLIC_API_BASE_URL=http://$1" >> ./.env
export LC_ALL=C export LC_ALL=C
export LC_CTYPE=C export LC_CTYPE=C
echo -e "\nSECRET_KEY=\"$(tr -dc 'a-z0-9!@#$%^&*(-_=+)' < /dev/urandom | head -c50)\"" >> ./apiserver/.env echo -e "\nSECRET_KEY=\"$(tr -dc 'a-z0-9!@#$%^&*(-_=+)' < /dev/urandom | head -c50)\"" >> ./.env

9
start.sh Normal file
View File

@ -0,0 +1,9 @@
#!/bin/sh
set -x
# Replace the statically built BUILT_NEXT_PUBLIC_WEBAPP_URL with run-time NEXT_PUBLIC_WEBAPP_URL
# NOTE: if these values are the same, this will be skipped.
/usr/local/bin/replace-env-vars.sh "$BUILT_NEXT_PUBLIC_API_BASE_URL" "$NEXT_PUBLIC_API_BASE_URL"
echo "Starting Plane Frontend.."
node apps/app/server.js

View File

@ -4,6 +4,7 @@
"NEXT_PUBLIC_GITHUB_ID", "NEXT_PUBLIC_GITHUB_ID",
"NEXT_PUBLIC_GOOGLE_CLIENTID", "NEXT_PUBLIC_GOOGLE_CLIENTID",
"NEXT_PUBLIC_API_BASE_URL", "NEXT_PUBLIC_API_BASE_URL",
"API_BASE_URL",
"NEXT_PUBLIC_SENTRY_DSN", "NEXT_PUBLIC_SENTRY_DSN",
"SENTRY_AUTH_TOKEN", "SENTRY_AUTH_TOKEN",
"NEXT_PUBLIC_SENTRY_ENVIRONMENT", "NEXT_PUBLIC_SENTRY_ENVIRONMENT",
@ -17,6 +18,7 @@
"NEXT_PUBLIC_CRISP_ID", "NEXT_PUBLIC_CRISP_ID",
"NEXT_PUBLIC_ENABLE_SESSION_RECORDER", "NEXT_PUBLIC_ENABLE_SESSION_RECORDER",
"NEXT_PUBLIC_SESSION_RECORDER_KEY", "NEXT_PUBLIC_SESSION_RECORDER_KEY",
"NEXT_PUBLIC_EXTRA_IMAGE_DOMAINS",
"NEXT_PUBLIC_SLACK_CLIENT_ID", "NEXT_PUBLIC_SLACK_CLIENT_ID",
"NEXT_PUBLIC_SLACK_CLIENT_SECRET" "NEXT_PUBLIC_SLACK_CLIENT_SECRET"
], ],

View File

@ -4229,6 +4229,11 @@ dot-case@^3.0.4:
no-case "^3.0.4" no-case "^3.0.4"
tslib "^2.0.3" tslib "^2.0.3"
dotenv@^16.0.3:
version "16.0.3"
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.0.3.tgz#115aec42bac5053db3c456db30cc243a5a836a07"
integrity sha512-7GO6HghkA5fYG9TYnNxi14/7K9f5occMlp3zXAuSxn7CKCxt9xbNWG7yF8hTCSUchlfWSe3uLmlPfigevRItzQ==
ejs@^3.1.6: ejs@^3.1.6:
version "3.1.8" version "3.1.8"
resolved "https://registry.npmjs.org/ejs/-/ejs-3.1.8.tgz" resolved "https://registry.npmjs.org/ejs/-/ejs-3.1.8.tgz"