Skip to content

Commit

Permalink
Merge branch 'develop' of github-cc-portal.com:IntersectMBO/cc-portal…
Browse files Browse the repository at this point in the history
… into feature/add-governance-action-worker-job
  • Loading branch information
BEdev24 committed Jun 24, 2024
2 parents 08a865c + e7ef953 commit fd62735
Show file tree
Hide file tree
Showing 52 changed files with 1,514 additions and 375 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/develop.yml
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
29 changes: 29 additions & 0 deletions .github/workflows/staging.yml
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
28 changes: 28 additions & 0 deletions backend/Dockerfile
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
38 changes: 0 additions & 38 deletions backend/docker-compose.yml

This file was deleted.

151 changes: 108 additions & 43 deletions docker-compose.yaml
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:
2 changes: 1 addition & 1 deletion frontend/.env.example
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
6 changes: 4 additions & 2 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
FROM node:18-alpine AS base
FROM node:20-alpine AS base

# Install dependencies only when needed
FROM base AS deps
RUN apk add --no-cache libc6-compat
RUN npm cache clean --force
RUN rm -rf node_modules
WORKDIR /app

# Install dependencies based on the preferred package manager
COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./
RUN \
if [ -f yarn.lock ]; then yarn --frozen-lockfile; \
elif [ -f package-lock.json ]; then npm ci; \
elif [ -f package-lock.json ]; then npm i; \
elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm i --frozen-lockfile; \
else echo "Lockfile not found." && exit 1; \
fi
Expand Down
24 changes: 21 additions & 3 deletions frontend/messages/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,19 @@
"notAvailable": "Not Available"
},
"MyActions": {
"title": "My Actions",
"actionTitle": "Manage"
"myVotesTab": "My Votes",
"gaTab": "Governance Actions",
"actionTitle": "Show more"
},
"GovernanceActions": {
"govAction": "Governance Action",
"govActionCategoryShort": "GA Category",
"status": "Status",
"abstract": "Abstract",
"actionTitle": "Show more",
"notAvailable": "Not Available",
"addReasoning": "Add Reasoning",
"updateReasoning": "Update Reasoning"
},
"Navigation": {
"addNewMember": "Add new member",
Expand Down Expand Up @@ -198,6 +209,9 @@
"heading": "Submission Date",
"paragraphOne": "The date when the governance action was submitted on-chain."
}
},
"alerts": {
"errorFetchingData": "Error fetching governance action data"
}
},
"govActionModal": {
Expand All @@ -219,11 +233,15 @@
},
"myActions": {
"title": "No votes found",
"description": "There is currently no actions. Please check back later for updates"
"description": "There is currently no votes. Please check back later for updates"
},
"constitution": {
"title": "No Constitution available",
"description": "There is currently no Constitution uploaded. Please check back later for updates"
},
"governanceAction": {
"title": "No governance actions available",
"description": "There is currently no governance actions. Please check back later for updates"
}
},
"Snackbar": {
Expand Down
Loading

0 comments on commit fd62735

Please sign in to comment.