Compare commits
9
Commits
1c789aa8d5
..
stable
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1dc0d9588f | ||
|
|
78f1a68438 | ||
|
|
6f0d0a952d | ||
|
|
574e3cb6c4 | ||
|
|
0739de4b44 | ||
|
|
a54f26f808 | ||
|
|
b5f1e7a469 | ||
|
|
e72a66fe94 | ||
|
|
8f92e53fa8 |
No files matched your search
@@ -22,6 +22,8 @@ FLASK_DEBUG=true
|
|||||||
# Development Mode - enables fake auth and mocking
|
# Development Mode - enables fake auth and mocking
|
||||||
DEV_MODE=true
|
DEV_MODE=true
|
||||||
|
|
||||||
|
APP_NAME=formeleon_dev
|
||||||
|
|
||||||
# Application port (default: 5000)
|
# Application port (default: 5000)
|
||||||
# PORT=5000
|
# PORT=5000
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,55 @@
|
|||||||
|
name: Formeleon Deployment Pipeline
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
- stable
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
# ---------------------------------------------------
|
||||||
|
# 1. DEPLOYMENT TO DEVELOPMENT (branch: main)
|
||||||
|
# ---------------------------------------------------
|
||||||
|
deploy-dev:
|
||||||
|
name: Deploy to Dev Environment
|
||||||
|
if: github.ref == 'refs/heads/main'
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Deploy via SSH to Dev
|
||||||
|
uses: appleboy/ssh-action@v1
|
||||||
|
with:
|
||||||
|
# Flexibel über "Settings -> Actions -> Variables" editierbar:
|
||||||
|
host: ${{ vars.DEV_HOST }}
|
||||||
|
username: ${{ vars.DEV_DEPLOY_USER }}
|
||||||
|
|
||||||
|
# Passwörter/Keys weiterhin über "Secrets":
|
||||||
|
key: ${{ secrets.DEV_SSH_KEY }}
|
||||||
|
port: 22
|
||||||
|
script: |
|
||||||
|
cd /cryptDisk/formeleon-dev
|
||||||
|
git pull origin main
|
||||||
|
docker compose down
|
||||||
|
docker compose up -d --build
|
||||||
|
|
||||||
|
# ---------------------------------------------------
|
||||||
|
# 2. DEPLOYMENT TO PRODUCTION (branch: stable)
|
||||||
|
# ---------------------------------------------------
|
||||||
|
deploy-prod:
|
||||||
|
name: Deploy to Production Environment
|
||||||
|
if: github.ref == 'refs/heads/stable'
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Deploy via SSH to Prod
|
||||||
|
uses: appleboy/ssh-action@v1
|
||||||
|
with:
|
||||||
|
host: ${{ vars.PROD_HOST }}
|
||||||
|
username: ${{ vars.PROD_DEPLOY_USER }}
|
||||||
|
key: ${{ secrets.PROD_SSH_KEY }}
|
||||||
|
port: 22
|
||||||
|
script: |
|
||||||
|
cd /cryptDisk/formeleon-prod
|
||||||
|
git pull origin stable
|
||||||
|
docker compose down
|
||||||
|
docker compose up -d --build
|
||||||
@@ -70,14 +70,14 @@ Für das vollständige Linux- / Staging-Gefühl kannst du Docker nutzen. Durch V
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
# 1. Image bauen und Container starten
|
# 1. Image bauen und Container starten
|
||||||
docker-compose up --build
|
docker compose up --build
|
||||||
|
|
||||||
# 2. Anwendung beenden
|
# 2. Anwendung beenden
|
||||||
# (Strg+C oder:)
|
# (Strg+C oder:)
|
||||||
docker-compose down
|
docker compose down
|
||||||
|
|
||||||
# 3. Datenbank und Volumes komplett zurücksetzen
|
# 3. Datenbank und Volumes komplett zurücksetzen
|
||||||
docker-compose down -v && docker-compose up --build
|
docker compose down -v && docker-compose up --build
|
||||||
```
|
```
|
||||||
|
|
||||||
### Docker CLI-Kommandos ausführen
|
### Docker CLI-Kommandos ausführen
|
||||||
@@ -85,16 +85,16 @@ Du kannst `flask` Kommandos direkt gegen den laufenden Container feuern:
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Datenbank Migrationen anlegen
|
# Datenbank Migrationen anlegen
|
||||||
docker-compose run --rm app flask db migrate -m "neue migration"
|
docker compose run --rm app flask db migrate -m "neue migration"
|
||||||
|
|
||||||
# Datenbank-Schema updaten
|
# Datenbank-Schema updaten
|
||||||
docker-compose run --rm app flask db upgrade
|
docker compose run --rm app flask db upgrade
|
||||||
|
|
||||||
# Datenbank mit Testdaten füllen
|
# Datenbank mit Testdaten füllen
|
||||||
docker-compose run --rm app flask seed-db
|
docker compose run --rm app flask seed-db
|
||||||
|
|
||||||
# Shell im Container öffnen
|
# Shell im Container öffnen
|
||||||
docker-compose run --rm app bash
|
docker compose run --rm app bash
|
||||||
```
|
```
|
||||||
|
|
||||||
### Zugriff auf die Anwendung
|
### Zugriff auf die Anwendung
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ from utils.cli import register_cli_commands
|
|||||||
from utils.middleware import setup_dev_mode_middleware, get_current_user, get_current_tenant
|
from utils.middleware import setup_dev_mode_middleware, get_current_user, get_current_tenant
|
||||||
from utils.helpers import get_request_context
|
from utils.helpers import get_request_context
|
||||||
|
|
||||||
|
from werkzeug.middleware.proxy_fix import ProxyFix
|
||||||
|
|
||||||
# Initialize extensions globally (will be bound to app in create_app)
|
# Initialize extensions globally (will be bound to app in create_app)
|
||||||
migrate = Migrate()
|
migrate = Migrate()
|
||||||
@@ -66,6 +67,12 @@ def create_app(config_class: Optional[type] = None) -> Flask:
|
|||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
app.config.from_object(config_class or get_config_class())
|
app.config.from_object(config_class or get_config_class())
|
||||||
|
|
||||||
|
|
||||||
|
# Vertraue 1 Reverse Proxy (NPM) für X-Forwarded-For, Proto, Host, Port
|
||||||
|
app.wsgi_app = ProxyFix(
|
||||||
|
app.wsgi_app, x_for=1, x_proto=1, x_host=1, x_port=1, x_prefix=1
|
||||||
|
)
|
||||||
|
|
||||||
# Set up logging
|
# Set up logging
|
||||||
setup_logging(app)
|
setup_logging(app)
|
||||||
|
|
||||||
@@ -229,4 +236,4 @@ app = create_app()
|
|||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
# This allows running the app directly with python app.py
|
# This allows running the app directly with python app.py
|
||||||
# In production, use gunicorn or other WSGI servers
|
# In production, use gunicorn or other WSGI servers
|
||||||
app.run(host='0.0.0.0', port=5000, debug=app.config['DEBUG'])
|
app.run(host='0.0.0.0', port=int(os.environ.get('PORT', 5000)), debug=app.config['DEBUG'])
|
||||||
+3
-2
@@ -3,9 +3,9 @@ services:
|
|||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
container_name: formeleon-app
|
container_name: "${APP_NAME:-formeleon}"
|
||||||
ports:
|
ports:
|
||||||
- "5000:5000"
|
- "${PORT:-5000}:5000"
|
||||||
volumes:
|
volumes:
|
||||||
# Mount entire project directory for hot-reload in development
|
# Mount entire project directory for hot-reload in development
|
||||||
# Exclude the virtual environment if it exists locally to prevent conflicts with container venv
|
# Exclude the virtual environment if it exists locally to prevent conflicts with container venv
|
||||||
@@ -13,6 +13,7 @@ services:
|
|||||||
- /app/venv
|
- /app/venv
|
||||||
# Persistent data volumes mapping to host
|
# Persistent data volumes mapping to host
|
||||||
# - ./data:/app/data
|
# - ./data:/app/data
|
||||||
|
- ./instance:/app/instance
|
||||||
- ./logs:/app/logs
|
- ./logs:/app/logs
|
||||||
# - ./formeleon.db:/app/formeleon.db
|
# - ./formeleon.db:/app/formeleon.db
|
||||||
env_file:
|
env_file:
|
||||||
|
|||||||
Reference in new issue
Block a user