Backend requirements bump

[backend] Bump fastapi to 0.111.0
[backend] Bump pydantic to 1.10.15
[backend] Bump uvicorn to 0.29.0
[backend] Bump python-dotenv to 1.0.1
[backend] Bump sqlalchemy to 2.0.30
[backend] Bump mysqlclient to 2.2.4
[backend] Bump requests to 2.32.2
[backend] Bump stravalib to 1.7
[backend] Bump python-multipart to 0.0.9
[README] README file updated
[frontend] Updated dockerfile for frontend image
[frontend] Added .env file for frontend docker image
[docker] Updated docker compose example file
This commit is contained in:
João Vitória Silva
2024-05-22 23:03:55 +01:00
parent dd46bb7790
commit 07268af5ce
9 changed files with 82 additions and 93 deletions

54
.gitignore vendored
View File

@@ -10,37 +10,35 @@ backend/*.log
# Frontend
frontend/img/users_img/*.*
# Frontend Vue.js
# Logs
frontend_vue/.gitignore
frontend_vue/logs
frontend_vue/*.log
frontend_vue/npm-debug.log*
frontend_vue/yarn-debug.log*
frontend_vue/yarn-error.log*
frontend_vue/pnpm-debug.log*
frontend_vue/lerna-debug.log*
frontend/.gitignore
frontend/logs
frontend/*.log
frontend/npm-debug.log*
frontend/yarn-debug.log*
frontend/yarn-error.log*
frontend/pnpm-debug.log*
frontend/lerna-debug.log*
frontend_vue/node_modules
frontend_vue/.DS_Store
frontend_vue/dist
frontend_vue/dist-ssr
frontend_vue/coverage
frontend_vue/*.local
frontend_vue/README.md
frontend/node_modules
frontend/.DS_Store
frontend/dist
frontend/dist-ssr
frontend/coverage
frontend/*.local
frontend/README.md
frontend_vue/cypress/videos/
frontend_vue/cypress/screenshots/
frontend/cypress/videos/
frontend/cypress/screenshots/
# Editor directories and files
frontend_vue/.vscode/*
frontend_vue/!.vscode/extensions.json
frontend_vue/.idea
frontend_vue/*.suo
frontend_vue/*.ntvs*
frontend_vue/*.njsproj
frontend_vue/*.sln
frontend_vue/*.sw?
frontend/.vscode/*
frontend/!.vscode/extensions.json
frontend/.idea
frontend/*.suo
frontend/*.ntvs*
frontend/*.njsproj
frontend/*.sln
frontend/*.sw?
frontend_vue/*.tsbuildinfo
frontend/*.tsbuildinfo

View File

@@ -1,7 +1,7 @@
FROM python:3.11
# Links Docker image with repository
LABEL org.opencontainers.image.source https://github.com/joaovitoriasilva/gearguardian
LABEL org.opencontainers.image.source https://github.com/joaovitoriasilva/endurain
# Set the working directory
WORKDIR /app

View File

@@ -1,42 +1,27 @@
# Use an official PHP runtime as a parent image
FROM php:8.3-apache
# Use an official node runtime as a parent image
FROM node:20-alpine as build-stage
# Links Docker image with repository
LABEL org.opencontainers.image.source https://github.com/joaovitoriasilva/gearguardian
LABEL org.opencontainers.image.source https://github.com/joaovitoriasilva/endurain
# Set the working directory to /var/www/html
WORKDIR /var/www/html
# Set the working directory to /app
WORKDIR /app
# Copy the current directory contents into the container at /var/www/html
COPY frontend/ /var/www/html
# Copy package.json and package-lock.json
COPY frontend/package*.json ./
RUN npm install
# Copy custom php.ini
COPY custom_php.ini /usr/local/etc/php/php.ini
# Copy the current directory contents into the container at /app
COPY frontend ./
# Install any dependencies your application needs
RUN apt-get update
# Build the app
RUN npm run build
# Change ownership of the directory to www-data:www-data
RUN chown -R www-data:www-data /var/www/html
# Use nginx to serve the built app
FROM nginx:alpine as production-stage
# Change permissions of the directory to 755
RUN chmod -R 755 /var/www/html
COPY --from=build-stage /app/dist /usr/share/nginx/html
# Expose port 80 to the outside world
EXPOSE 80
# Define environment variables
ENV APACHE_DOCUMENT_ROOT /var/www/html
# Enable Apache modules
RUN a2enmod rewrite
# Update the default virtual host to use the environment variable
RUN sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf
# Define environment variable
ENV BACKEND_PROTOCOL="http"
ENV BACKEND_HOST="backend"
# Start Apache
CMD ["apache2-foreground"]
CMD ["nginx", "-g", "daemon off;"]

View File

@@ -66,11 +66,17 @@ BACKEND_HOST** | backend | Yes
**BACKEND_HOST needs to be set and be Internet faced/resolved if you want to enable Strava integration. Strava callback relies on this.
Frontend dependencies:
- php:8.3-apache
- vue@3.4.24
- vue-router@4.3.2
- vue-i18n@9.13.1
- vite@5.2.10
- pinia@2.1.7
- crypto-js@4.2.0
- chart.js@4.4.2
- User avatars create using DiceBear (https://www.dicebear.com) avataaars style.
- Bootstrap CSS v5.3.2
- leaflet v1.7.1
- fontawesome icons free version
- Bootstrap CSS v5.3.3
- leaflet v1.9.4
- fontawesome icons free version@6.5.2 and vue-fontawesome@3.0.6
- Logo created using Canvas
---
@@ -111,22 +117,21 @@ MYSQL_USER | gearguardian | `No`
MYSQL_PASSWORD | changeme | `No`
Python backend dependencies used:
- python:3.11
- fastapi==0.108.0
- pydantic==1.10.9
- uvicorn==0.25.0
- python-dotenv==1.0.0
- sqlalchemy==2.0.25
- mysqlclient==2.2.1
- fastapi==0.111.0
- pydantic==1.10.15
- uvicorn==0.29.0
- python-dotenv==1.0.1
- sqlalchemy==2.0.30
- mysqlclient==2.2.4
- python-jose[cryptography]==3.3.0
- passlib[bcrypt]==1.7.4
- apscheduler==3.10.4
- requests==2.31.0
- stravalib==1.5
- requests==2.32.2
- stravalib==1.7
- opentelemetry-sdk==1.22.0
- opentelemetry-instrumentation-fastapi==0.43b0
- opentelemetry.exporter.otlp==1.22.0
- python-multipart==0.0.6
- python-multipart==0.0.9
- gpxpy==1.6.2
- alembic==1.13.1

View File

@@ -4,16 +4,16 @@ services:
frontend:
container_name: frontend
image: ghcr.io/joaovitoriasilva/endurain/frontend:latest
environment:
- BACKEND_PROTOCOL=https # http or https, default is http
- BACKEND_HOST=backend # api host, default is backend
#environment:
#- VITE_BACKEND_PROTOCOL=http # http or https, default is http
#- VITE_BACKEND_HOST=backend # api host, default is backend
# Configure volume if you want to edit the code locally by clomming the repo
#volumes:
# - <local_path>/endurain/frontend:/var/www/html
# - <local_path>/endurain/frontend:/app
ports:
- "8080:80" # frontend port, change per your needs
env_file:
- .env
- ./frontend/.env
restart: unless-stopped
# API logic
@@ -26,6 +26,7 @@ services:
- STRAVA_CLIENT_ID=changeme
- STRAVA_CLIENT_SECRET=changeme
- STRAVA_AUTH_CODE=changeme
- GEOCODES_MAPS_API=changeme
- FRONTEND_HOST=frontend # default is frontend
ports:
- "98:80" # API port, change per your needs
@@ -33,7 +34,7 @@ services:
#volumes:
# - <local_path>/endurain/backend:/app
env_file:
- .env
- ./backend/.env
depends_on:
- mariadb
- jaeger

2
frontend/.env Normal file
View File

@@ -0,0 +1,2 @@
VITE_BACKEND_PROTOCOL=http
VITE_BACKEND_HOST=backend

View File

@@ -9,8 +9,7 @@ export const strava = {
},
linkStrava(state) {
const stravaClientId = '115321';
//const redirectUri = process.env.VUE_APP_API_URL || 'http://localhost:98';
let redirectUri = 'http://localhost:98';
let redirectUri = `${import.meta.env.VITE_BACKEND_PROTOCOL}://${import.meta.env.VITE_BACKEND_HOST}`;
redirectUri = encodeURIComponent(redirectUri);
const scope = 'read,read_all,profile:read_all,activity:read,activity:read_all';

View File

@@ -1,5 +1,4 @@
//const API_URL = process.env.VUE_APP_API_URL || 'http://localhost:98/';
const API_URL = 'http://localhost:98/';
const API_URL = `${import.meta.env.VITE_BACKEND_PROTOCOL}://${import.meta.env.VITE_BACKEND_HOST}/`;
/**
* Makes a GET request to the specified URL with optional headers.

View File

@@ -1,17 +1,17 @@
fastapi==0.108.0
pydantic==1.10.9
uvicorn==0.25.0
python-dotenv==1.0.0
sqlalchemy==2.0.25
mysqlclient==2.2.1
fastapi==0.111.0
pydantic==1.10.15
uvicorn==0.29.0
python-dotenv==1.0.1
sqlalchemy==2.0.30
mysqlclient==2.2.4
python-jose[cryptography]==3.3.0
passlib[bcrypt]==1.7.4
apscheduler==3.10.4
requests==2.31.0
stravalib==1.5
requests==2.32.2
stravalib==1.7
opentelemetry-sdk==1.22.0
opentelemetry-instrumentation-fastapi==0.43b0
opentelemetry.exporter.otlp==1.22.0
python-multipart==0.0.6
python-multipart==0.0.9
gpxpy==1.6.2
alembic==1.13.1