-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature/release-milestone3-devops (#132)
* milestone2 catch-up * dockerize worker-service * refactor * remove unnecessary * add ci pipeline * add SSH_KEY * fix: workflow changes * comment pipelines --------- Co-authored-by: nike-getto <[email protected]>
- Loading branch information
1 parent
0b5f4d6
commit 1f077ca
Showing
17 changed files
with
344 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# name: CI-develop-branch | ||
|
||
# on: | ||
# push: | ||
# branches: [develop] | ||
|
||
# workflow_dispatch: | ||
|
||
# jobs: | ||
# deploy_to_do: | ||
# runs-on: ubuntu-latest | ||
# steps: | ||
# - name: Checkout the repo | ||
# uses: actions/checkout@v4 | ||
# with: | ||
# ref: develop | ||
|
||
# - name: Deploy to Digital Ocean droplet via SSH action | ||
# uses: appleboy/[email protected] | ||
# with: | ||
# host: ${{ secrets.DEVELOP_HOST }} | ||
# username: ${{ secrets.USERNAME }} | ||
# key: ${{ secrets.SSHKEY }} | ||
# script: | | ||
# eval `ssh-agent -s` | ||
# ssh-add cc | ||
# cd cc-portal \ | ||
# && git pull origin develop \ | ||
# && docker compose up -d --force-recreate --build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# name: CI-staging-branch | ||
|
||
# on: | ||
# push: | ||
# branches: [staging] | ||
|
||
# workflow_dispatch: | ||
|
||
# jobs: | ||
# deploy_to_do: | ||
# runs-on: ubuntu-latest | ||
# steps: | ||
# - name: Checkout the repo | ||
# uses: actions/checkout@v4 | ||
# with: | ||
# ref: staging | ||
|
||
# - name: Deploy to Digital Ocean droplet via SSH action | ||
# uses: appleboy/[email protected] | ||
# with: | ||
# host: ${{ secrets.STAGING_HOST }} | ||
# username: ${{ secrets.USERNAME }} | ||
# key: ${{ secrets.SSH_KEY }} | ||
# script: | | ||
# eval `ssh-agent -s` | ||
# ssh-add cc | ||
# cd cc-portal \ | ||
# && git pull origin staging \ | ||
# && docker compose up -d --force-recreate --build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Use the official Node.js 20 image as the base image | ||
FROM node:20 | ||
|
||
# Set the working directory inside the container | ||
WORKDIR /app | ||
|
||
# Copy the package.json and package-lock.json files to the working directory | ||
COPY package.json ./ | ||
|
||
# Install the project dependencies | ||
RUN npm install | ||
|
||
# Copy the rest of the application code to the working directory | ||
COPY . . | ||
|
||
# Expose the port that the application will run on | ||
EXPOSE 1337 | ||
EXPOSE 5432 | ||
|
||
RUN npm run build | ||
|
||
# Start the application | ||
# Removed start:prod because dist/main doesn't exist | ||
CMD [ "npm", "run", "start:dev" ] | ||
# Build the application | ||
|
||
|
||
# Set the environment variables |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,124 @@ | ||
version: "3" | ||
services: | ||
backend: | ||
container_name: backend # Name of the backend container | ||
build: # Build configuration for the backend | ||
context: ./backend # Directory containing Dockerfile | ||
build: | ||
context: ./backend | ||
dockerfile: Dockerfile | ||
image: strapi:latest # Use the latest Strapi image | ||
restart: unless-stopped # Always restart unless explicitly stopped | ||
environment: # Environment variables for configuration | ||
HOST: 0.0.0.0 | ||
PORT: 1337 | ||
DATABASE_HOST: database # Link to the database service by name | ||
DATABASE_NAME: pdf_db | ||
DATABASE_USERNAME: postgres | ||
DATABASE_PASSWORD: postgres | ||
NODE_ENV: development # Set node environment to development | ||
volumes: # Mount points for persistent data and source code | ||
- ./backend/config:/opt/app/config | ||
- ./backend/public/uploads:/opt/app/public/uploads | ||
container_name: backend | ||
restart: unless-stopped | ||
ports: | ||
- "1337:1337" # Expose port 1337 to the host | ||
- "1337:1337" | ||
networks: | ||
- strapi # Connect to the 'strapi' network | ||
- bloxico_local | ||
depends_on: | ||
- database # Depends on the database service | ||
database: | ||
container_name: database # Name of the database container | ||
platform: linux/arm64 # Specify the platform (important for ARM64 architectures) | ||
image: postgres:12.0-alpine # Use PostgreSQL 12 on Alpine for smaller size | ||
- psql | ||
- cache | ||
- s3 | ||
- ipfs | ||
|
||
worker: | ||
build: | ||
context: ./worker-service | ||
dockerfile: Dockerfile | ||
container_name: worker | ||
restart: unless-stopped | ||
environment: # PostgreSQL user, password, and database name | ||
POSTGRES_USER: postgres | ||
POSTGRES_PASSWORD: postgres | ||
POSTGRES_DB: pdf_db | ||
networks: | ||
- bloxico_local | ||
|
||
ipfs: | ||
build: | ||
context: ./ipfs-service | ||
dockerfile: Dockerfile | ||
container_name: ipfs-service | ||
ports: | ||
- "3001:3001" | ||
- "4001:4001" | ||
- "4002:4002" | ||
- "4003:4003" | ||
- "5001:5001" | ||
- "8080:8080" | ||
volumes: | ||
- ipfs_data:/ipfs/datastore | ||
networks: | ||
- bloxico_local | ||
extra_hosts: | ||
- "host.docker.internal:host-gateway" | ||
depends_on: | ||
- s3 | ||
- cache | ||
|
||
psql: | ||
image: postgres:10 | ||
container_name: postgres | ||
environment: | ||
POSTGRES_DB: cc-portal | ||
POSTGRES_USER: BEdev24 | ||
POSTGRES_PASSWORD: bedev.bloxico24 | ||
volumes: | ||
- "psql-data:/var/lib/postgresql/data/" | ||
ports: | ||
- "5432:5432" | ||
command: > | ||
bash -c ' | ||
/usr/local/bin/docker-entrypoint.sh postgres & | ||
pid=$!; | ||
echo "Waiting for PostgreSQL to start..."; | ||
while ! pg_isready -q -h postgres -p 5432; do | ||
sleep 1; | ||
done; | ||
PGUSER=BEdev24 PGPASSWORD=bedev.bloxico24 psql -U BEdev24 -d cc-portal -c "CREATE EXTENSION IF NOT EXISTS \"uuid-ossp\";"; | ||
wait $pid | ||
' | ||
networks: | ||
- bloxico_local | ||
|
||
cache: | ||
image: redis/redis-stack:latest | ||
container_name: cache | ||
restart: always | ||
ports: | ||
- "6379:6379" | ||
volumes: | ||
- cache:/data | ||
networks: | ||
- bloxico_local | ||
|
||
s3: | ||
image: minio/minio | ||
container_name: minio | ||
ports: | ||
- "9000:9000" | ||
- "9001:9001" | ||
environment: | ||
MINIO_ROOT_USER: bloxico | ||
MINIO_ROOT_PASSWORD: bloxico2 | ||
command: ["server", "/data", "--console-address", ":9001"] | ||
volumes: | ||
- strapi-data:/var/lib/postgresql/data/ # Persistent storage for the database | ||
- s3_data:/data | ||
networks: | ||
- strapi # Connect to the 'strapi' network | ||
- bloxico_local | ||
|
||
frontend: | ||
container_name: frontend # Name of the frontend container | ||
build: # Build configuration for the frontend | ||
build: | ||
context: ./frontend | ||
dockerfile: Dockerfile | ||
restart: unless-stopped | ||
environment: | ||
NEXT_PUBLIC_API_URL: http://localhost:1337 # Environment variable for the API URL | ||
container_name: frontend | ||
networks: | ||
- bloxico_local | ||
|
||
proxy: | ||
build: | ||
context: ./proxy | ||
dockerfile: Dockerfile | ||
container_name: proxy | ||
ports: | ||
- "3000:3000" # Expose port 3000 to the host | ||
- "80:80" | ||
networks: | ||
- strapi # Connect to the 'strapi' network | ||
depends_on: | ||
- backend # Depends on the backend service | ||
- bloxico_local | ||
|
||
volumes: | ||
strapi-data: # Define a volume for PostgreSQL data | ||
cache: | ||
s3_data: | ||
ipfs_data: | ||
psql-data: | ||
networks: | ||
strapi: # Custom network for inter-container communication | ||
name: Strapi | ||
driver: bridge | ||
bloxico_local: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
NEXT_PUBLIC_API_URL=http://localhost:1337 | ||
NEXT_PUBLIC_API_URL=http://backend:1337 # Container name goes here |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Use the official Node.js 20 image as the base image | ||
FROM node:20 | ||
|
||
# Set the working directory inside the container | ||
WORKDIR /app | ||
|
||
# Copy the package.json and package-lock.json files to the working directory | ||
COPY . . | ||
|
||
RUN rm -rf node_modules | ||
RUN rm -rf package-lock.json | ||
|
||
# Install the project dependencies | ||
RUN npm install | ||
|
||
RUN npm install --build-from-source node-datachannel | ||
|
||
|
||
# Expose the port that the application will run on | ||
EXPOSE 3001 | ||
EXPOSE 4001 | ||
EXPOSE 4002 | ||
EXPOSE 4003 | ||
EXPOSE 5001 | ||
EXPOSE 8080 | ||
|
||
RUN npm run build | ||
|
||
# Start the application | ||
CMD [ "npm", "run", "start:dev" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
BEdev24:$apr1$a2j1Eyns$TqZgNQkeiTekg.Nv.6DFh/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Use the official Nginx image | ||
FROM nginx:latest | ||
|
||
# Copy custom Nginx configuration file | ||
COPY nginx.conf /etc/nginx/nginx.conf | ||
|
||
# Copy password file for basic authentication | ||
COPY .htpasswd /etc/nginx/.htpasswd |
Oops, something went wrong.