diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f4d01da..0e2ce4d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,7 +12,7 @@ jobs: - name: 🔍 Checkout do repositorio uses: actions/checkout@v3 - - name: 🚀 Deploy to vps + - name: 🚀 Deploy uses: easingthemes/ssh-deploy@main env: SSH_PRIVATE_KEY: ${{ secrets.SSHKEY }} @@ -21,14 +21,4 @@ jobs: REMOTE_USER: ${{ secrets.USERNAME }} TARGET: ${{ secrets.TARGET }} EXCLUDE: ".env, /test/, .gitignore" - SCRIPT_AFTER: | - # Criar o ambiente virtual - python3.11 -m venv /var/www/blog/.venv - # Ativar o ambiente virtual - source /var/www/blog/.venv/bin/activate - # Atualizar o pip e instalar as dependências - python3.11 -m pip install --upgrade pip - pip install -r /var/www/blog/requirements.txt - # Desativar o ambiente virtual - deactivate - sudo service apache2 restart + diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..870f97c --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +FROM python:3.11 + +WORKDIR /var/www/cleverson.online + +COPY requirements.txt . + +RUN pip install -r requirements.txt + +COPY . . + +CMD ['gunicorn','-b', '0.0.0.0:5000', 'wsgi:app'] diff --git a/LICENSE b/LICENSE index 21942bb..b08f931 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2024 Cleverson +Copyright (c) 2024 Cleverson.online Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..c1185a0 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,28 @@ +version: "3.5" + +services: + nginx: + image: nginx:latest + volumes: + - ./nginx.conf:/etc/nginx/nginx.conf:ro + environment: + - FLASK_SERVER_ADDR=app:5000 + depends_on: + - app + ports: + - "80:80" + + app: + build: + context: . + ports: + - '5000:5000' + volumes: + - ${HOME}/.database:/root/.database + command: gunicorn -w 2 -b 0.0.0.0:5000 wsgi:app + + +networks: + default: + driver: bridge + name: cleverson.online diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..2525be1 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,19 @@ +events {} + +http { + access_log on; + sendfile on; + + server { + listen 80; + server_name localhost; + + location / { + proxy_pass http://app:5000; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + } + } +} diff --git a/requirements.txt b/requirements.txt index 90d4221..dccb116 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,3 +5,5 @@ Flask-Session >= 0.5.0 bcrypt >= 4.1.2 unidecode >= 1.3.8 pytz>=2024.1 +cachelib>=0.12.0 +gunicorn>=21.2.0 diff --git a/templates/login.html b/templates/login.html deleted file mode 100644 index 5f416a5..0000000 --- a/templates/login.html +++ /dev/null @@ -1,13 +0,0 @@ -{% extends "layout.html" %} - -{% block y %} - -

Login

- -
- - - -
- -{% endblock %} \ No newline at end of file diff --git a/templates/register.html b/templates/register.html deleted file mode 100644 index 8800bff..0000000 --- a/templates/register.html +++ /dev/null @@ -1,13 +0,0 @@ -{% extends "layout.html" %} - -{% block y %} - -

REGISTER

- -
- - - -
- -{% endblock %} \ No newline at end of file diff --git a/wsgi.py b/wsgi.py new file mode 100644 index 0000000..fe05d46 --- /dev/null +++ b/wsgi.py @@ -0,0 +1,6 @@ +from app import create_app + +app = create_app() + +if __name__ == "__main__": + app.run()