Dev #102
@@ -45,10 +45,24 @@ jobs:
|
||||
find /home/erp/core/publish -type f -exec chmod 644 {} +
|
||||
chmod +x /home/erp/core/publish/ERPCore
|
||||
- name: Restart service
|
||||
# ConnectionStrings__DefaultConnection is supplied by the systemd unit on the host
|
||||
# (Environment= or EnvironmentFile=), deliberately not committed: appsettings.json ships
|
||||
# the key empty and appsettings.Production.json carries no ConnectionStrings section at
|
||||
# all. If the unit does not set it, startup throws before serving and the Verify step
|
||||
# below fails the job.
|
||||
run: systemctl restart erpcore.service
|
||||
- name: Verify
|
||||
run: |
|
||||
systemctl is-active erpcore.service && echo "✅ Service running" || echo "❌ Service failed"
|
||||
# `is-active ... || echo` always exited 0, so a crashed service still reported success.
|
||||
# Wait a few seconds first: a startup failure (bad or missing connection string) happens
|
||||
# during MigrateAsync, after systemctl restart has already returned.
|
||||
sleep 5
|
||||
if ! systemctl is-active --quiet erpcore.service; then
|
||||
echo "❌ erpcore.service is not running:"
|
||||
journalctl -u erpcore.service -n 50 --no-pager
|
||||
exit 1
|
||||
fi
|
||||
echo "✅ Service running"
|
||||
|
||||
build-and-deploy-frontend:
|
||||
name: Build & Deploy Frontend
|
||||
|
||||
@@ -36,8 +36,14 @@ builder.Services.AddControllers()
|
||||
// commands (`dotnet ef migrations add`) and startup depend on the database being reachable.
|
||||
// MariaDbServerVersion — not MySqlServerVersion — because the target is MariaDB 10.11, and
|
||||
// Pomelo changes its SQL translation based on which it is given.
|
||||
var connectionString = builder.Configuration.GetConnectionString("DefaultConnection")
|
||||
?? throw new InvalidOperationException("ConnectionStrings:DefaultConnection is not configured.");
|
||||
// IsNullOrWhiteSpace, not just null: appsettings.json ships the key with an empty value so the
|
||||
// shape is self-documenting, and each environment supplies the real one. A blank must fail here
|
||||
// with this message rather than reaching UseMySql, which would report an opaque parse error.
|
||||
var connectionString = builder.Configuration.GetConnectionString("DefaultConnection");
|
||||
if (string.IsNullOrWhiteSpace(connectionString))
|
||||
throw new InvalidOperationException(
|
||||
"ConnectionStrings:DefaultConnection is not configured. Set it in appsettings.<Environment>.json "
|
||||
+ "or as the ConnectionStrings__DefaultConnection environment variable.");
|
||||
|
||||
builder.Services.AddDbContext<ErpDbContext>(o =>
|
||||
{
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
}
|
||||
},
|
||||
"ConnectionStrings": {
|
||||
"DefaultConnection": "Host=localhost;Port=5432;Database=ERPCoreTest;Username=postgres;Password=post@hexdive"
|
||||
"DefaultConnection": "server=localhost;port=3306;database=erpcore;user=poojathmi;password=poojathmi@hexdive.com"
|
||||
},
|
||||
"Urls": "http://0.0.0.0:6701",
|
||||
"Auth": {
|
||||
|
||||
Reference in New Issue
Block a user