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:
@@ -29,10 +29,10 @@
|
||||
// "workload": "sudo /usr/share/dotnet/dotnet workload update",
|
||||
"eftool": "/usr/share/dotnet/dotnet tool install --global dotnet-ef",
|
||||
"system": "sudo apt update && sudo apt upgrade -y",
|
||||
"backend": "cd backend && /usr/share/dotnet/dotnet restore"
|
||||
// "frontend": "cd frontend && yarn install"
|
||||
"backend": "cd backend && /usr/share/dotnet/dotnet restore",
|
||||
"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.
|
||||
// "customizations": {},
|
||||
|
||||
@@ -28,8 +28,8 @@ If you want to use Kestrel as your primary web server (with no reverse proxy), y
|
||||
|
||||
#### 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`)
|
||||
- `LettuceEncrypt:CertificatesPath=/persistence` - path to store Let's Encrypt certificates (default: `/persistence` for `Production` and `data.db` for `Development`)
|
||||
- `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`)
|
||||
|
||||
> **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
|
||||
|
||||
## 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
|
||||
Path: `.github/workflows`
|
||||
|
||||
@@ -31,7 +31,9 @@ WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
if (builder.Configuration.GetSection("LettuceEncrypt").Exists())
|
||||
builder.Services.AddLettuceEncrypt()
|
||||
.PersistDataToDirectory(new DirectoryInfo("/persistence"), null);
|
||||
.PersistDataToDirectory(new DirectoryInfo(
|
||||
builder.Configuration.GetValue<string>("LettuceEncrypt:CertificatesPath") ?? "/persistence"
|
||||
), null);
|
||||
}
|
||||
|
||||
WebApplication app = builder.Build();
|
||||
|
||||
@@ -6,6 +6,6 @@
|
||||
}
|
||||
},
|
||||
"ConnectionStrings": {
|
||||
"DataContext": "Data Source=app.db"
|
||||
"DataContext": "Data Source=data.db"
|
||||
}
|
||||
}
|
||||
|
||||
+10
-2
@@ -5,13 +5,21 @@ services:
|
||||
image: "muicharts-backend:latest"
|
||||
build:
|
||||
context: ./backend
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost/swagger"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 5
|
||||
ports:
|
||||
- "80:80"
|
||||
- "443:443"
|
||||
volumes:
|
||||
- ./persistence:/persistence
|
||||
- ./persistence:/var/persistence
|
||||
environment:
|
||||
- "HTTPS_PORTS=443"
|
||||
- "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"
|
||||
- "ConnectionStrings:DataContext=Data Source=/var/persistence/data.db"
|
||||
- "LettuceEncrypt:CertificatesPath=/var/persistence"
|
||||
|
||||
Reference in New Issue
Block a user