From 6466c6cad6b4587b27534daa23a990a9376a3348 Mon Sep 17 00:00:00 2001 From: adam Date: Fri, 13 Dec 2024 21:00:06 -0500 Subject: [PATCH] working directory --- $REPO_NAME.service | 1 + Configuration.cs | 1 + Jenkinsfile | 6 ++---- appsettings.sample.json | 1 + 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/$REPO_NAME.service b/$REPO_NAME.service index 8ef58dc..de73b45 100644 --- a/$REPO_NAME.service +++ b/$REPO_NAME.service @@ -4,6 +4,7 @@ After=network-online.target [Service] Type=simple +WorkingDirectory=/home/$REPO_NAME/dist/ ExecStart=/home/$REPO_NAME/dist/$REPO_NAME ExecReload=/bin/kill -s HUP $MAINPID NoNewPrivileges=true diff --git a/Configuration.cs b/Configuration.cs index 12db475..1cd6fa6 100644 --- a/Configuration.cs +++ b/Configuration.cs @@ -2,6 +2,7 @@ namespace $REPO_NAME { public class Configuration { + public string urls { get; set; } public string DBConnectionString { get; set; } } } \ No newline at end of file diff --git a/Jenkinsfile b/Jenkinsfile index b10b389..ac569df 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -47,7 +47,7 @@ pipeline { withCredentials([sshUserPrivateKey(credentialsId: env.linuxServiceAccountID, keyFileVariable: 'PK')]) { sh """#!/bin/bash - ssh -i \"$${PK}\" -tt $${linuxServiceAccount_USR}@$${targetHost} 'systemctl --user stop $$REPO_NAME' + ssh -i \"$${PK}\" -tt $${linuxServiceAccount_USR}@$${targetHost} 'systemctl --user stop $REPO_NAME' """ } } @@ -63,9 +63,7 @@ pipeline { """ sh """#!/bin/bash - pushd dist dotnet ef database update --connection "$${env.productiondatabase_connectionString}" - popd """ //TODO: if updating the db fails, restore the old one sh """#!/bin/bash @@ -95,7 +93,7 @@ pipeline { withCredentials([sshUserPrivateKey(credentialsId: env.linuxServiceAccountID, keyFileVariable: 'PK')]) { sh """#!/bin/bash - ssh -i \"$${PK}\" -tt $${linuxServiceAccount_USR}@$${targetHost} 'systemctl --user start $$REPO_NAME' + ssh -i \"$${PK}\" -tt $${linuxServiceAccount_USR}@$${targetHost} 'systemctl --user start $REPO_NAME' """ } } diff --git a/appsettings.sample.json b/appsettings.sample.json index 96fb449..4ded6cb 100644 --- a/appsettings.sample.json +++ b/appsettings.sample.json @@ -5,5 +5,6 @@ "Microsoft.AspNetCore": "Warning" } }, + "urls": "http://0.0.0.0:0;", "DBConnectionString": "Host=localhost;Database=${REPO_NAME}_dev;Username=$REPO_NAME;Password=wnmhOttjA0wCiR9hVoG7jjrf90SxWvAV;IncludeErrorDetail=true;" }