diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 0c5e523..ad4bfa3 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -69,8 +69,8 @@ jobs: run: | aws ssm send-command --instance-ids ${{ env.INSTANCE_ID }} --document-name "AWS-RunShellScript" --comment "Create and start service" --parameters 'commands=[ "aws s3 cp s3://s3-bucket-safeqr/update_env_var.sh /home/ssm-user/update_env_var.sh", - "chmod +x /home/ssm-user/update_env_var.sh", - "source /home/ssm-user/.bashrc", + "sudo chmod +x /home/ssm-user/update_env_var.sh", + "sudo source /home/ssm-user/.bashrc", 'sudo bash -c echo \\"[Unit]\nDescription=Spring Boot Application\nAfter=network.target\n\n[Service]\nUser=ssm-user\nEnvironment=\"SERVER_DB_URL=${SERVER_DB_URL}\" \"SERVER_DB_USERNAME=${SERVER_DB_USERNAME}\" \"SERVER_DB_PASSWORD=${SERVER_DB_PASSWORD}\" \"SERVER_DB_DRIVER_CLASS_NAME=${SERVER_DB_DRIVER_CLASS_NAME}\" \"SERVER_SSL_KEY_STORE_LOCATION=${SERVER_SSL_KEY_STORE_LOCATION}\" \"SERVER_SSL_KEY_STORE_PASSWORD=${SERVER_SSL_KEY_STORE_PASSWORD}\" \"SERVER_SSL_KEY_ALIAS=${SERVER_SSL_KEY_ALIAS}\" \"SERVER_SSL_TRUST_STORE_LOCATION=${SERVER_SSL_TRUST_STORE_LOCATION}\" \"SERVER_SSL_TRUST_STORE_PASSWORD=${SERVER_SSL_TRUST_STORE_PASSWORD}\" \"SERVER_PORT=${SERVER_PORT}\"\nExecStart=/usr/bin/java -jar /home/ssm-user/app-0.0.1-SNAPSHOT.jar\nSuccessExitStatus=143\nRestart=always\nRestartSec=3\n\n[Install]\nWantedBy=multi-user.target\n\\" > /etc/systemd/system/springboot-app.service', "sudo systemctl daemon-reload", "sudo systemctl enable springboot-app",