Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/mit-27/Panora into add-auth…
Browse files Browse the repository at this point in the history
…-credentials-feature
  • Loading branch information
mit-27 committed Apr 16, 2024
2 parents 70325b4 + 449bcaa commit 0a09716
Show file tree
Hide file tree
Showing 10 changed files with 129 additions and 24 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/docker.check-build.backend.selfhosted.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Compile Docker Images (Backend Selfhosted)

on:
pull_request:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest
env:
ENVIRONMENT: SELF_HOSTED

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build and push Backend (API)
uses: docker/build-push-action@v2
with:
platforms: linux/amd64,linux/arm64
context: .
file: ./packages/api/Dockerfile
push: false
tags: panoradotdev/backend-api:selfhosted
build-args: |
OAUTH_REDIRECT_BASE=${{ env.OAUTH_REDIRECT_BASE }}
DISTRIBUTION=${{ env.DISTRIBUTION }}
ENV=${{ ENV }}
DATABASE_URL=postgresql://${{env.POSTGRES_USER}}:${{secrets.POSTGRES_PASSWORD}}@${{env.POSTGRES_HOST}}:5432/${{env.POSTGRES_DB}}?ssl=false
JWT_SECRET=${{ secrets.JWT_SECRET }}
REDIS_HOST=redis
ENCRYPT_CRYPTO_SECRET_KEY=${{ secrets.ENCRYPT_CRYPTO_SECRET_KEY }}
HUBSPOT_CLIENT_ID=${{ secrets.HUBSPOT_CLIENT_ID }}
HUBSPOT_CLIENT_SECRET=${{ secrets.HUBSPOT_CLIENT_SECRET }}
ZOHOCRM_CLIENT_ID=${{ secrets.ZOHOCRM_CLIENT_ID }}
ZOHOCRM_CLIENT_SECRET=${{ secrets.ZOHOCRM_CLIENT_SECRET }}
PIPEDRIVE_CLIENT_ID=${{ secrets.PIPEDRIVE_CLIENT_ID }}
PIPEDRIVE_CLIENT_SECRET=${{ secrets.PIPEDRIVE_CLIENT_SECRET }}
ZENDESK_CLIENT_ID=${{ secrets.ZENDESK_CLIENT_ID }}
ZENDESK_CLIENT_SECRET=${{ secrets.ZENDESK_CLIENT_SECRET }}
ZENDESK_TICKETING_CLIENT_ID=${{ secrets.ZENDESK_TICKETING_CLIENT_ID }}
ZENDESK_TICKETING_CLIENT_SECRET=${{ secrets.ZENDESK_TICKETING_CLIENT_SECRET }}
53 changes: 53 additions & 0 deletions .github/workflows/docker.check-build.frontend.selfhosted.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Compile Docker Images (Frontend Selfhosted)

on:
pull_request:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest
env:
ENVIRONMENT: SELF_HOSTED

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build and push Frontend (Magic Links)
uses: docker/build-push-action@v2
with:
platforms: linux/amd64,linux/arm64
context: .
file: ./apps/magic-link/Dockerfile
push: false
tags: panoradotdev/frontend-magic-links:selfhosted
build-args: |
VITE_BACKEND_DOMAIN=${{ secrets.VITE_BACKEND_DOMAIN }}
- name: Build and push Frontend (Dashboard)
uses: docker/build-push-action@v2
with:
platforms: linux/amd64,linux/arm64
context: .
file: ./apps/client-ts/Dockerfile
push: true
tags: panoradotdev/frontend-webapp:selfhosted
build-args: |
NEXT_PUBLIC_BACKEND_DOMAIN=${{ secrets.NEXT_PUBLIC_BACKEND_DOMAIN }}
NEXT_PUBLIC_MAGIC_LINK_DOMAIN=${{ secrets.NEXT_PUBLIC_MAGIC_LINK_DOMAIN }}
NEXT_PUBLIC_STYTCH_PROJECT_ID=${{ secrets.NEXT_PUBLIC_STYTCH_PROJECT_ID }}
NEXT_PUBLIC_STYTCH_SECRET=${{ secrets.NEXT_PUBLIC_STYTCH_SECRET }}
NEXT_PUBLIC_STYTCH_PROJECT_ENV=${{ secrets.NEXT_PUBLIC_STYTCH_PROJECT_ENV }}
NEXT_PUBLIC_STYTCH_PUBLIC_TOKEN=${{ secrets.NEXT_PUBLIC_STYTCH_PUBLIC_TOKEN }}
NEXT_PUBLIC_DISTRIBUTION=${{ env.DISTRIBUTION }}
3 changes: 0 additions & 3 deletions .github/workflows/docker.export.backend.selfhosted.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build:
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/docker.export.frontend.selfhosted.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build:
Expand Down
7 changes: 0 additions & 7 deletions apps/client-ts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,3 @@ To learn more about Next.js, take a look at the following resources:
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.

You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!

## Deploy on Vercel

The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.

Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
1 change: 1 addition & 0 deletions apps/magic-link/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
pnpm run build
```


## Run

```
Expand Down
3 changes: 1 addition & 2 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ services:
retries: 1000 # Try launching the API service as long as possible. Required for other services to start

redis:
image: "redis:7.2.3-alpine"
image: valkey/valkey:7.2-alpine
container_name: "Redis"
ports:
- "6379:6379"
Expand Down Expand Up @@ -141,7 +141,6 @@ services:
depends_on:
api:
condition: service_healthy

volumes:
- .:/app
networks:
Expand Down
7 changes: 4 additions & 3 deletions docker-compose.source.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ services:
context: ./
dockerfile: ./packages/api/Dockerfile
environment:
DOPPLER_TOKEN: ${DOPPLER_TOKEN_API}
DATABASE_URL: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:5432/${POSTGRES_DB}?ssl=false
DISTRIBUTION: ${DISTRIBUTION}
JWT_SECRET: ${JWT_SECRET}
Expand Down Expand Up @@ -101,7 +102,7 @@ services:
- backend

redis:
image: 'redis:7.2.3-alpine'
image: valkey/valkey:7.2-alpine
container_name: 'Redis'
ports:
- '6379:6379'
Expand All @@ -125,7 +126,7 @@ services:
NEXT_PUBLIC_WEBAPP_DOMAIN: ${NEXT_PUBLIC_WEBAPP_DOMAIN}
restart: unless-stopped
ports:
- 80:3000
- 80:8090
depends_on:
- api
networks:
Expand All @@ -137,7 +138,7 @@ services:
dockerfile: ./apps/magic-link/Dockerfile
context: ./
args:
NEXT_PUBLIC_MAGIC_LINK_DOMAIN: ${NEXT_PUBLIC_MAGIC_LINK_DOMAIN}
VITE_BACKEND_DOMAIN: ${NEXT_PUBLIC_MAGIC_LINK_DOMAIN}
restart: always
ports:
- 81:80
Expand Down
8 changes: 4 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ services:
- backend

api:
image: panoradotdev/backend-api:latest
image: panoradotdev/backend-api:selfhosted
environment:
DATABASE_URL: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:5432/${POSTGRES_DB}?ssl=false
DISTRIBUTION: ${DISTRIBUTION}
Expand Down Expand Up @@ -97,7 +97,7 @@ services:
- backend

redis:
image: "redis:7.2.3-alpine"
image: valkey/valkey:7.2-alpine
container_name: "Redis"
ports:
- "6379:6379"
Expand All @@ -107,7 +107,7 @@ services:
- backend

magic-link-frontend:
image: panoradotdev/frontend-magic-links:latest
image: panoradotdev/frontend-magic-links:selfhosted
restart:
always
ports:
Expand All @@ -120,7 +120,7 @@ services:


webapp-next:
image: panoradotdev/frontend-webapp:latest
image: panoradotdev/frontend-webapp:selfhosted
environment:
NEXT_PUBLIC_STYTCH_PROJECT_ID: ${NEXT_PUBLIC_STYTCH_PROJECT_ID}
NEXT_PUBLIC_STYTCH_SECRET: ${NEXT_PUBLIC_STYTCH_SECRET}
Expand Down
16 changes: 14 additions & 2 deletions packages/api/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,19 @@ FROM base AS runner
WORKDIR /app

COPY --from=installer ./app .
WORKDIR /app/packages/api

# # # # # # # # # # # #
# Launching the backend
# Maintain the root api folder as context (Breaking)
CMD cd /app/packages/api && node dist/src/main.js
# # # # # # # # # # # #
# DEV: Maintain the /app/packages/api folder as context (Breaking)
# # # # # # # # # # # #
CMD node dist/src/main.js

# # # # # # # # # # # #
# Production: Injects env vars via Doppler - DOPPLER_TOKEN variable must be set
# Install Doppler CLI
# RUN wget -q -t3 'https://packages.doppler.com/public/cli/rsa.8004D9FF50437357.key' -O /etc/apk/keys/[email protected] && \
# echo 'https://packages.doppler.com/public/cli/alpine/any-version/main' | tee -a /etc/apk/repositories && \
# apk add doppler
# CMD doppler run --command="node dist/src/main.js"

0 comments on commit 0a09716

Please sign in to comment.