Skip to content
Closed
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
GROUP_ID=00
GROUP_ID=10
DOMAIN=localhost
URL_PREFIX=http://
PORT_PREFIX=2
Expand Down
43 changes: 43 additions & 0 deletions .github/workflows/code-quality-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Code Quality Check

on:
pull_request:
branches: [ main, dev ]

jobs:
lint-and-test:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Python for Backend
uses: actions/setup-python@v3
with:
python-version: '3.9'

- name: Install Backend Dependencies
run: pip install -r backend/requirements.txt

- name: Run Backend Linting
run: flake8 backend/

- name: Set up Node.js for Frontend
uses: actions/setup-node@v3
with:
node-version: '18'

- name: Install Frontend Dependencies
run: npm install --prefix frontend/

- name: Run Frontend Linting
run: npm run lint --prefix frontend/

- name: Run Backend Tests
run: pytest backend/tests/

- name: Run Frontend Tests
run: npm test --prefix frontend/



45 changes: 45 additions & 0 deletions .github/workflows/docker-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Deploy to Development

on:
push:
branches:
- main # Trigger workflow when code is pushed to the main branch

jobs:
deploy-dev:
runs-on: self-hosted # Ensure you're using your self-hosted runner

steps:
- name: Checkout repository
uses: actions/checkout@v3 # Checkout the latest code

# Optionally, set environment variables (if needed)
- name: Set up environment variables
uses: falti/dotenv-action@v1.1.4
with:
export-variables: true
keys-case: bypass

- name: Check environment variables
run: env

# Stop and remove existing Docker containers
- name: Stop and remove existing containers
run: |
sudo docker compose down || true
# Pull the latest Docker images (if using remote images)
- name: Pull latest Docker images
run: sudo docker compose pull || true

# Build Docker images if there are any changes
- name: Build Docker images
run: sudo docker compose build --no-cache

# Start Docker containers (detached mode)
- name: Start Docker containers
run: sudo docker compose up -d

# Verify that the containers are running
- name: Verify running Docker containers
run: sudo docker ps -a
49 changes: 49 additions & 0 deletions .github/workflows/nginx_deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Setup Nginx from the configuration file

on:
pull_request:
branches:
- main

jobs:
deploy:
runs-on: self-hosted # Ensure your runner is self-hosted

steps:
- name: Checkout repository
uses: actions/checkout@v3

# Optionally set environment variables (skip if not needed)
- name: Set up environment variables
uses: falti/dotenv-action@v1.1.4
with:
export-variables: true
keys-case: bypass

- name: Check environment variables
run: env

# Copy Nginx configuration to the server
- name: Copy Nginx configuration to server
run: |
sudo cp ./nginx_securefit.conf /etc/nginx/conf.d/nginx_securefit.conf
# Test the Nginx configuration for errors
- name: Test Nginx Configuration
run: |
sudo nginx -t
# Reload Nginx to apply the new configuration
- name: Reload Nginx
run: |
sudo systemctl reload nginx
# Check if Nginx is running properly
- name: Check Nginx status
run: |
sudo systemctl status nginx
# Optionally, display the deployed Nginx configuration for debugging
- name: Show deployed Nginx configuration
run: |
cat /etc/nginx/conf.d/nginx_securefit.conf
35 changes: 35 additions & 0 deletions nginx_securefit.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Production server configuration
server {
listen 80;

location / {
proxy_pass http://0.0.0.0:8080/; # Replace with actual service URL
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}

# Development server configuration
server {
listen 8081;

location / {
proxy_pass http://0.0.0.0:8081/; # Replace with actual service URL
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}

# Staging server configuration
server {
listen 8082;

location / {
proxy_pass http://0.0.0.0:8082/; # Replace with actual service URL
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}