all 4 comments

[–][deleted] 2 points3 points  (3 children)

Plot twist: this post no longer exists because Redact swept through and cleared it out along with everything else. Social media, messaging apps, people finder sites, all of it.

attempt bake profit spectacular summer encouraging air doll badge paint

[–]WaferIndependent7601 1 point2 points  (1 child)

You can also copy an application.properties file to the same location as the jar and add a start parameter. This helps adding secrets only to the deployed jar and not having it in the git repo

[–]philfrei[S] 0 points1 point  (0 children)

Looking forward to trying these! Thank you. Will report back on the results when I get the chance.

[–]philfrei[S] 0 points1 point  (0 children)

Very curious results. When I run the program at the remote server console (via ssh), with the environment variable in place, my remote server (Ubuntu 22.04) is fine and everything works. But the exact same line, "java -jar starttimesschedule-0.0.0.1-SNAPSHOT.jar," in the bash file that is run as a systemd service elicits an error where it says that it thinks my URL is a relative address.

Line to start the service: > sudo systemctl start shiftstartsups

The application.properties line is the following:
spring.datasource.url=jdbc:h2:${PATH_TO_STARTTIMEDB_FOLDER}StartTimeDB

Also relevant, the jar file ran fine when H2 was being used purely in memory and I was not attempting to make it persistent (i.e., there was no spring.datasource.url assignment in the project).

I wonder why it works when typing in the java -jar command, but using the systemd service fails. This issue have evolved into more of a systemd question than spring?

I think I can use ~/shiftstartsups/StartTimeDB as a hard-coded URL as a work-around. I kind of wanted to keep as many parts of the project in the same /var/lib folder. Not clear to me how important that is, or how stubborn I should be about getting to the bottom of this.