Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hotfix/1.9.1 #4

Merged
merged 28 commits into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
adfd1c6
Merge branch 'hotfix/1.7.3'
davitJabushanuri Dec 10, 2023
14390a0
Merge branch 'release/1.8.0'
davitJabushanuri Dec 12, 2023
eb1a553
chore: add unsaved code
davitJabushanuri Feb 15, 2024
4b4be3c
Merge branch 'release/1.9.0'
davitJabushanuri Feb 15, 2024
ab15b73
chore: bump version number to 1.9.1
davitJabushanuri Feb 15, 2024
0f041f4
chore: remove screen-reader-only links
davitJabushanuri Feb 15, 2024
cdec67e
chore: add docker support
davitJabushanuri Feb 17, 2024
7ad0396
chore: remove cypress
davitJabushanuri Feb 17, 2024
3ab2ad0
chore: update docker configuration
davitJabushanuri Feb 17, 2024
f209976
chore: remove faker from dependencies
davitJabushanuri Feb 18, 2024
d557694
chore: remove vercel-analytics and axiom from the project
davitJabushanuri Feb 18, 2024
7442f9d
chore: remove vercel kv and axiom from dependencies
davitJabushanuri Feb 18, 2024
8a49f79
refactor: middleware to use upstash/redis instead of vercel/kv for ra…
davitJabushanuri Feb 18, 2024
8cf78e8
refactor: add reconnection delay to socket io, remove console.log fro…
davitJabushanuri Feb 21, 2024
9e40a6f
feat: add socket url env to dockerfile, needed during build process
davitJabushanuri Feb 21, 2024
29c739a
chore: add deploy workflow
davitJabushanuri Feb 21, 2024
cf0caf7
chore: add build arguments needed for building the app
davitJabushanuri Feb 21, 2024
95bab51
chore: add .dockerignore file and git to .dockerignore
davitJabushanuri Feb 21, 2024
359c4a9
chore: add a staging environment
davitJabushanuri Feb 21, 2024
b32bf85
chore: update .env.example file and add instructions for each environ…
davitJabushanuri Feb 24, 2024
3bff66a
chore: make environment variables typesafe
davitJabushanuri Feb 25, 2024
dad28fa
chore: create multi stage Dockerfile for improved build process and r…
davitJabushanuri Feb 25, 2024
3bf8cdc
chore: create docker-compose-dev for local development
davitJabushanuri Feb 25, 2024
ef0f437
chore: add docker scripts
davitJabushanuri Feb 25, 2024
c713929
chore: delete docker-compose.dev.yml file
davitJabushanuri Feb 27, 2024
65cc034
chore: give name to the docker container
davitJabushanuri Feb 27, 2024
68fb23b
chore: update Dockerfile to copy only the files that are needed to bu…
davitJabushanuri Feb 27, 2024
42cf28c
chore: downgrade sharp version to 32.6 to make it work in standalone …
davitJabushanuri Feb 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
### STANDARD GIT IGNORE FILE ###

# DEPENDENCIES
node_modules/
/.pnp
.pnp.js
package-lock.json
yarn.lock

# TESTING
/coverage
*.lcov
.nyc_output

# BUILD
build/
public/build/
dist/
generated/

# ENV FILES
.env
.env.local
.env.development.local
.env.test.local
.env.production.local

# LOGS
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# MISC
.idea
.turbo/
.cache/
.next/
.nuxt/
tmp/
temp/
.eslintcache
.docusaurus

# MAC
._*
.DS_Store
Thumbs.db

.turbo
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts

Dockerfile
.dockerignore
.git
62 changes: 37 additions & 25 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,25 +1,37 @@
# Database configuration
# Replace with your database URL. For example: postgres://user:password@localhost:5432/mydatabase
DATABASE_URL=""

# NextAuth configuration
# Replace with your NextAuth URL. This is the URL where your application is running. For example: http://localhost:3000
NEXTAUTH_URL=""

# Generate a secret for NextAuth with `openssl rand -hex 64` and replace here
NEXTAUTH_SECRET=""

# Google OAuth configuration
# Replace with your Google Client ID and Secret. These are obtained from the Google Developer Console.
GOOGLE_CLIENT_ID=""
GOOGLE_CLIENT_SECRET=""

# Node environment
# Set to "development" for development mode or "production" for production mode
NODE_ENV="development"

# Vercel KV configuration
KV_URL=""
KV_REST_API_URL=""
KV_REST_API_TOKEN=""
KV_REST_API_READ_ONLY_TOKEN=""
# DATABASE CONFIGURATION
# The application uses a PostgreSQL database. You can obtain the database URL from your database provider.
DATABASE_URL=postgres://username:password@localhost:5432/your-database

# NEXTAUTH CONFIGURATION
# NextAuth is used for authentication in the application. You need to specify the URL where the Next.js application is running and a secret for session cookies.

NEXTAUTH_URL=http://localhost:3000

# You can generate a random secret using a tool like `uuidgen` or any other random string generator.
NEXTAUTH_SECRET=

# GOOGLE AUTHENTICATION CONFIGURATION
# The application supports authentication with Google. You need to create a project in the Google Developers Console, enable the Google Sign-In API, and create OAuth 2.0 credentials.
# More information: https://developers.google.com/identity/sign-in/web/sign-in
GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=

# SUPABASE CONFIGURATION
# The application uses Supabase for real-time updates. You need to create a project in Supabase and obtain the URL and the anonymous key.
# More information: https://supabase.io/docs/guides/with-nextjs

# Example: https://yourproject.supabase.co
NEXT_PUBLIC_SUPABASE_URL=
NEXT_PUBLIC_SUPABASE_ANON_KEY=

# WEBSOCKET CONFIGURATION
# The application uses a WebSocket server for real-time communication. Specify the URL of the WebSocket server.
# Example: http://localhost:8080
NEXT_PUBLIC_SOCKET_URL=

# UPSTASH CONFIGURATION
# The application uses Upstash for rate limiting.
# You need to create an account on Upstash and obtain the Redis REST URL and Token.
# More information: https://upstash.com
UPSTASH_REDIS_REST_URL=
UPSTASH_REDIS_REST_TOKEN=
9 changes: 0 additions & 9 deletions .env.local.example

This file was deleted.

2 changes: 0 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ module.exports = {
"plugin:jsx-a11y/recommended",
"plugin:testing-library/react",
"plugin:jest-dom/recommended",
"plugin:cypress/recommended",
"plugin:@tanstack/eslint-plugin-query/recommended",
"plugin:tailwindcss/recommended",
"prettier",
Expand All @@ -23,7 +22,6 @@ module.exports = {
"@typescript-eslint",
"testing-library",
"jest-dom",
"cypress",
"@tanstack/query",
"prettier",
],
Expand Down
37 changes: 37 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Deploy
on:
push:
branches:
- main
- develop
pull_request: {}

jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: 👀 Read app name
uses: SebRollen/[email protected]
id: app_name
with:
file: "fly.toml"
field: "app"

- name: Setup fly
uses: superfly/flyctl-actions/setup-flyctl@master

- name: Deploy Staging
if: ${{ github.ref == 'develop' }}
run: flyctl deploy --remote-only --build-arg NEXT_PUBLIC_SOCKET_URL=${{ secrets.NEXT_PUBLIC_SOCKET_URL }} --build-arg NEXT_PUBLIC_SUPABASE_URL=${{secrets.NEXT_PUBLIC_SUPABASE_URL}} --build-arg NEXT_PUBLIC_SUPABASE_ANON_KEY=${{secrets.NEXT_PUBLIC_SUPABASE_ANON_KEY}} --app ${{ steps.app_name.outputs.value }}-staging
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}

- name: Deploy Production
if: ${{ github.ref == 'refs/heads/main' }}
run: flyctl deploy --remote-only --build-arg NEXT_PUBLIC_SOCKET_URL=${{ secrets.NEXT_PUBLIC_SOCKET_URL }} --build-arg NEXT_PUBLIC_SUPABASE_URL=${{secrets.NEXT_PUBLIC_SUPABASE_URL}} --build-arg NEXT_PUBLIC_SUPABASE_ANON_KEY=${{secrets.NEXT_PUBLIC_SUPABASE_ANON_KEY}}
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
67 changes: 67 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
ARG NODE_VERSION=20.10.0
# base image
FROM node:${NODE_VERSION}-slim as base

# Set output property to standalone for minimal image size
ENV BUILD_STANDALONE="true"

# Disable telemetry
ENV NEXT_TELEMETRY_DISABLED="1"

# Set environment variables needed for the build process
ARG NEXT_PUBLIC_SUPABASE_URL
ENV NEXT_PUBLIC_SUPABASE_URL=${NEXT_PUBLIC_SUPABASE_URL}

ARG NEXT_PUBLIC_SUPABASE_ANON_KEY
ENV NEXT_PUBLIC_SUPABASE_ANON_KEY=${NEXT_PUBLIC_SUPABASE_ANON_KEY}

ARG NEXT_PUBLIC_SOCKET_URL
ENV NEXT_PUBLIC_SOCKET_URL=${NEXT_PUBLIC_SOCKET_URL}

# Install openssl for Prisma
RUN apt-get update && apt-get install -y openssl

# Install pnpm
ARG PNPM_VERSION=8.15.1
RUN npm install -g pnpm@$PNPM_VERSION

# Install dependencies
FROM base as deps
WORKDIR /app

# Install node modules
COPY --link package.json pnpm-lock.yaml ./
RUN pnpm install --frozen-lockfile

# Build the application
FROM base as build
WORKDIR /app

# Copy application code
COPY src/ src/
COPY public/ public/
COPY prisma/schema.prisma prisma/
COPY next.config.js postcss.config.js tailwind.config.js tsconfig.json reset.d.ts ./

COPY --from=deps /app/node_modules ./node_modules
COPY --from=deps /app/package.json ./package.json
COPY --from=deps /app/pnpm-lock.yaml ./pnpm-lock.yaml

# Generate Prisma Client
RUN npx prisma generate

# Build application
RUN pnpm build

# Production image
FROM base as prod
WORKDIR /app

ENV NODE_ENV="production"

COPY --from=build /app/public ./public
COPY --from=build /app/.next/standalone ./
COPY --from=build /app/.next/static ./.next/static

EXPOSE 3000
CMD [ "node", "server.js" ]
16 changes: 0 additions & 16 deletions cypress.config.ts

This file was deleted.

Loading
Loading