-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from Cleanwalk-org-QNSCNT/feat/discover-view
Feature: add mobile V2 version
- Loading branch information
Showing
98 changed files
with
5,441 additions
and
1,457 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,30 @@ | ||
name: Deploy to VPS | ||
|
||
on: | ||
push: | ||
branches: | ||
- release # Déclencher le déploiement uniquement sur la branche release | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up SSH | ||
uses: webfactory/[email protected] | ||
with: | ||
ssh-private-key: ${{ secrets.SECRET_KEY }} # Utilisation de la clé SSH | ||
|
||
- name: Deploy to VPS | ||
env: | ||
VPS_IP: ${{ secrets.VPS_IP }} | ||
run: | | ||
ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null root@$VPS_IP ' | ||
cd /home/cleanwalk-org-v2 && | ||
git pull origin release && | ||
docker compose -f docker-compose.prod.yml down && | ||
docker compose -f docker-compose.prod.yml up -d --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 |
---|---|---|
|
@@ -35,3 +35,8 @@ lerna-debug.log* | |
*.njsproj | ||
*.sln | ||
*.sw? | ||
|
||
/uploads | ||
|
||
/data-nginx | ||
/letsencrypt |
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 |
---|---|---|
|
@@ -51,6 +51,49 @@ To shutdown all stack or just a specific one: | |
docker compose down | ||
``` | ||
|
||
### Production | ||
## Production | ||
|
||
### config nginx proxy manager | ||
|
||
**first login**: connect to @server_ip:81 | ||
- username: [email protected] | ||
- password: changeme **! change admin info** | ||
|
||
**proxy hosts** | ||
Go to Hosts > Proxy Hosts and click on Add Proxy Host. | ||
|
||
**frontend** | ||
- Domain Names: yourdomain.example, www.yourdomain.example | ||
- Scheme: http | ||
- Forward Hostname / IP: frontend | ||
- Forward Port: 80 | ||
|
||
**API** | ||
- Domain Names: api.yourdomain.example | ||
- Scheme: http | ||
- Forward Hostname / IP: api | ||
- Forward Port: 5000 | ||
|
||
**uploads** | ||
- Domain Names : uploads.yourdomain.example | ||
- Scheme : http | ||
- Forward Hostname / IP : nginx-proxy-manager | ||
- Forward Port : 81 | ||
|
||
in advanced add: | ||
``` | ||
location / { | ||
alias /var/www/uploads/; | ||
autoindex on; | ||
} | ||
``` | ||
|
||
**SSL Config** | ||
- check Force SSL | ||
- select Request a new SSL certificate | ||
- add email and save | ||
|
||
|
||
|
||
|
||
|
||
Use Portainer for easier management. To install it, launch the script named "install-portainer.sh" and to access it you can check the service on port 9000. |
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,3 +1,5 @@ | ||
DATABASE_URI=mysql+mysqlconnector://root:root@localhost:3306/cleanwalk_db | ||
DATABASE_URI=mysql+pymysql://user:password@localhost/cleanwalk_db | ||
API_KEY=1234567890 | ||
JWT_SECRET_KEY=098765433 | ||
UPLOAD_FOLDER=uploads | ||
UPLOADS_URL=https://uploads.cleanwalk.org |
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Utilisez une image Python comme image de base | ||
FROM python:3.8-alpine | ||
|
||
# Définissez le répertoire de travail dans le conteneur | ||
WORKDIR /app | ||
|
||
# Copiez les fichiers de dépendances dans le conteneur | ||
COPY requirements.txt . | ||
|
||
# Installez les dépendances | ||
RUN pip install --no-cache-dir -r requirements.txt | ||
|
||
# Copiez le reste du code dans le conteneur | ||
COPY . . | ||
|
||
# Exposez le port sur lequel l'API s'exécute | ||
EXPOSE 5000 | ||
|
||
# Démarrez l'API | ||
CMD ["python3", "app.py"] |
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,23 @@ | ||
# Utiliser une image Python comme image de base | ||
FROM python:3.8-alpine | ||
|
||
# Définir le répertoire de travail dans le conteneur | ||
WORKDIR /app | ||
|
||
# Copier les fichiers de dépendances dans le conteneur | ||
COPY requirements.txt . | ||
|
||
# Installer les dépendances | ||
RUN pip install --no-cache-dir -r requirements.txt | ||
|
||
# Copier le reste du code dans le conteneur | ||
COPY . . | ||
|
||
# Créer le dossier pour les uploads et définir les permissions | ||
RUN mkdir -p /app/uploads && chmod -R 755 /app/uploads | ||
|
||
# Exposer le port sur lequel l'API s'exécute | ||
EXPOSE 5000 | ||
|
||
# Démarrer l'API avec Gunicorn | ||
CMD ["gunicorn", "--bind", "0.0.0.0:5000", "wsgi:app"] |
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,41 +1,7 @@ | ||
from flask import Flask | ||
from flask_jwt_extended import JWTManager | ||
from app.models import db | ||
from dotenv import load_dotenv | ||
import os | ||
from datetime import timedelta | ||
|
||
# load environement variables from .env file | ||
load_dotenv() | ||
|
||
ACCESS_EXPIRES = timedelta(minutes=1) | ||
|
||
app = Flask(__name__) | ||
|
||
#configure the SQLAlchemy database using environment variables | ||
app.config['SQLALCHEMY_DATABASE_URI'] = os.getenv('DATABASE_URI') | ||
app.config['API_KEY'] = os.getenv('API_KEY') | ||
app.config['JWT_SECRET_KEY'] = os.getenv('JWT_SECRET_KEY') | ||
app.config["JWT_ACCESS_TOKEN_EXPIRES"] = ACCESS_EXPIRES | ||
|
||
#Init the JWTManager extension | ||
jwt = JWTManager(app) | ||
|
||
# Init the SQLAlchemy database | ||
db.init_app(app) | ||
|
||
from app.routes.users import users_bp | ||
from app.routes.articles import articles_bp | ||
from app.routes.cleanwalks import cleanwalks_bp | ||
from app.routes.cities import cities_bp | ||
from app.routes.admin import admin_bp | ||
|
||
app.register_blueprint(users_bp , url_prefix='/users') | ||
app.register_blueprint(articles_bp , url_prefix='/articles') | ||
app.register_blueprint(cleanwalks_bp , url_prefix='/cleanwalks') | ||
app.register_blueprint(cities_bp , url_prefix='/cities') | ||
app.register_blueprint(admin_bp , url_prefix='/admin') | ||
# app.py | ||
from app import create_app | ||
|
||
app = create_app() | ||
|
||
if __name__ == '__main__': | ||
app.run(host='0.0.0.0', port=5000, debug=True) |
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,46 @@ | ||
# app/__init__.py | ||
from flask import Flask | ||
from flask_jwt_extended import JWTManager | ||
from flask_sqlalchemy import SQLAlchemy | ||
from flask_cors import CORS | ||
from dotenv import load_dotenv | ||
import os | ||
from datetime import timedelta | ||
|
||
# Charger les variables d'environnement | ||
load_dotenv() | ||
|
||
# Initialiser l'extension SQLAlchemy | ||
db = SQLAlchemy() | ||
|
||
def create_app(): | ||
app = Flask(__name__) | ||
CORS(app) | ||
# Configurer l'application | ||
app.config['SQLALCHEMY_DATABASE_URI'] = os.getenv('DATABASE_URI') | ||
app.config['API_KEY'] = os.getenv('API_KEY') | ||
app.config['JWT_SECRET_KEY'] = os.getenv('JWT_SECRET_KEY') | ||
app.config["JWT_ACCESS_TOKEN_EXPIRES"] = timedelta(days=30) | ||
app.config['UPLOAD_FOLDER'] = os.getenv('UPLOAD_FOLDER') | ||
app.config['UPLOADS_URL'] = os.getenv('UPLOADS_URL') | ||
|
||
# Initialiser les extensions | ||
db.init_app(app) | ||
JWTManager(app) | ||
|
||
# Enregistrer les blueprints | ||
from app.routes.users import users_bp | ||
from app.routes.articles import articles_bp | ||
from app.routes.cleanwalks import cleanwalks_bp | ||
from app.routes.cities import cities_bp | ||
from app.routes.admin import admin_bp | ||
from app.routes.upload import upload_bp | ||
|
||
app.register_blueprint(users_bp, url_prefix='/users') | ||
app.register_blueprint(articles_bp, url_prefix='/articles') | ||
app.register_blueprint(cleanwalks_bp, url_prefix='/cleanwalks') | ||
app.register_blueprint(cities_bp, url_prefix='/cities') | ||
app.register_blueprint(admin_bp, url_prefix='/admin') | ||
app.register_blueprint(upload_bp, url_prefix='/upload') | ||
|
||
return app |
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
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
Oops, something went wrong.