Merge pull request 'update on production db' (#101) from feat/mysql-migration into Dev
Reviewed-on: #101
This commit was merged in pull request #101.
This commit is contained in:
@@ -45,10 +45,24 @@ jobs:
|
|||||||
find /home/erp/core/publish -type f -exec chmod 644 {} +
|
find /home/erp/core/publish -type f -exec chmod 644 {} +
|
||||||
chmod +x /home/erp/core/publish/ERPCore
|
chmod +x /home/erp/core/publish/ERPCore
|
||||||
- name: Restart service
|
- 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
|
run: systemctl restart erpcore.service
|
||||||
- name: Verify
|
- name: Verify
|
||||||
run: |
|
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:
|
build-and-deploy-frontend:
|
||||||
name: Build & 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.
|
// commands (`dotnet ef migrations add`) and startup depend on the database being reachable.
|
||||||
// MariaDbServerVersion — not MySqlServerVersion — because the target is MariaDB 10.11, and
|
// MariaDbServerVersion — not MySqlServerVersion — because the target is MariaDB 10.11, and
|
||||||
// Pomelo changes its SQL translation based on which it is given.
|
// Pomelo changes its SQL translation based on which it is given.
|
||||||
var connectionString = builder.Configuration.GetConnectionString("DefaultConnection")
|
// IsNullOrWhiteSpace, not just null: appsettings.json ships the key with an empty value so the
|
||||||
?? throw new InvalidOperationException("ConnectionStrings:DefaultConnection is not configured.");
|
// 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 =>
|
builder.Services.AddDbContext<ErpDbContext>(o =>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ConnectionStrings": {
|
"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",
|
"Urls": "http://0.0.0.0:6701",
|
||||||
"Auth": {
|
"Auth": {
|
||||||
|
|||||||
Reference in New Issue
Block a user