1
0
mirror of https://github.com/XFox111/MuiCharts.git synced 2026-04-22 06:51:05 +03:00

Minor backend refactoring

This commit is contained in:
2024-02-22 19:16:17 +00:00
parent fcb1e7f687
commit ffab73b530
5 changed files with 20 additions and 10 deletions
+3 -3
View File
@@ -29,10 +29,10 @@
// "workload": "sudo /usr/share/dotnet/dotnet workload update", // "workload": "sudo /usr/share/dotnet/dotnet workload update",
"eftool": "/usr/share/dotnet/dotnet tool install --global dotnet-ef", "eftool": "/usr/share/dotnet/dotnet tool install --global dotnet-ef",
"system": "sudo apt update && sudo apt upgrade -y", "system": "sudo apt update && sudo apt upgrade -y",
"backend": "cd backend && /usr/share/dotnet/dotnet restore" "backend": "cd backend && /usr/share/dotnet/dotnet restore",
// "frontend": "cd frontend && yarn install" "frontend": "cd frontend && yarn install"
}, },
"postStartCommand": "sudo /usr/share/dotnet/dotnet workload update", "postStartCommand": "sudo /usr/share/dotnet/dotnet workload update"
// Configure tool-specific properties. // Configure tool-specific properties.
// "customizations": {}, // "customizations": {},
+3 -3
View File
@@ -28,8 +28,8 @@ If you want to use Kestrel as your primary web server (with no reverse proxy), y
#### Data persistence #### Data persistence
Configure these options if you want to change default paths for data persistence: Configure these options if you want to change default paths for data persistence:
- `ConnectionStrings:DataContext=Data Source=/persistence/data.db` - SQLite DB connection string (default: `/persistence/data.db`) - `ConnectionStrings:DataContext=Data Source=/persistence/data.db` - SQLite DB connection string (default: `Data Source=/persistence/data.db` for `Production` and `Data Source=data.db` for `Development`)
- `LettuceEncrypt:CertificatesPath=/persistence` - path to store Let's Encrypt certificates (default: `/persistence` for `Production` and `data.db` for `Development`) - `LettuceEncrypt:CertificatesPath=/persistence` - path to store Let's Encrypt certificates (default: `/persistence`)
> **IMPORTANT**: default persistence paths are configured to be used in a Docker container, where the user is `root`. `/persistence` is not writtable by a non-root user, so you need either to change the paths if you want to run the app outside of a container without root privileges or run app as `sudo`. > **IMPORTANT**: default persistence paths are configured to be used in a Docker container, where the user is `root`. `/persistence` is not writtable by a non-root user, so you need either to change the paths if you want to run the app outside of a container without root privileges or run app as `sudo`.
@@ -41,7 +41,7 @@ Frontend is a simple React app with Material-UI. It consumes the RESTful API pro
> 🚧 WIP > 🚧 WIP
## Docker ## Docker
Use sample `docker-compose.yml` file to deploy the project on one server using Nginx Use sample `docker-compose.yml` to see how to deploy project using Docker
## GitHub Actions ## GitHub Actions
Path: `.github/workflows` Path: `.github/workflows`
+3 -1
View File
@@ -31,7 +31,9 @@ WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
if (builder.Configuration.GetSection("LettuceEncrypt").Exists()) if (builder.Configuration.GetSection("LettuceEncrypt").Exists())
builder.Services.AddLettuceEncrypt() builder.Services.AddLettuceEncrypt()
.PersistDataToDirectory(new DirectoryInfo("/persistence"), null); .PersistDataToDirectory(new DirectoryInfo(
builder.Configuration.GetValue<string>("LettuceEncrypt:CertificatesPath") ?? "/persistence"
), null);
} }
WebApplication app = builder.Build(); WebApplication app = builder.Build();
@@ -6,6 +6,6 @@
} }
}, },
"ConnectionStrings": { "ConnectionStrings": {
"DataContext": "Data Source=app.db" "DataContext": "Data Source=data.db"
} }
} }
+10 -2
View File
@@ -5,13 +5,21 @@ services:
image: "muicharts-backend:latest" image: "muicharts-backend:latest"
build: build:
context: ./backend context: ./backend
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost/swagger"]
interval: 30s
timeout: 10s
retries: 5
ports: ports:
- "80:80" - "80:80"
- "443:443" - "443:443"
volumes: volumes:
- ./persistence:/persistence - ./persistence:/var/persistence
environment: environment:
- "HTTPS_PORTS=443" - "HTTPS_PORTS=443"
- "LettuceEncrypt:AcceptTermsOfService=true" - "LettuceEncrypt:AcceptTermsOfService=true"
- "LettuceEncrypt:DomainNames:0=containers.xfox111.net" - "LettuceEncrypt:DomainNames:0=example.com"
- "LettuceEncrypt:DomainNames:1=www.example.com"
- "LettuceEncrypt:EmailAddress=eugene@xfox111.net" - "LettuceEncrypt:EmailAddress=eugene@xfox111.net"
- "ConnectionStrings:DataContext=Data Source=/var/persistence/data.db"
- "LettuceEncrypt:CertificatesPath=/var/persistence"