From 212ab638a2c393c7e691696e32c6900a25764390 Mon Sep 17 00:00:00 2001 From: Anthony Debucquoy Date: Wed, 6 Mar 2024 10:01:55 +0100 Subject: [PATCH] allow unix socket connection for database in prod --- .gitea/workflows/deploy.yaml | 2 +- backend/src/main/java/ovh/herisson/Clyde/JdbcConfig.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/deploy.yaml b/.gitea/workflows/deploy.yaml index 8239a07..e01bb46 100644 --- a/.gitea/workflows/deploy.yaml +++ b/.gitea/workflows/deploy.yaml @@ -53,5 +53,5 @@ jobs: scp -o "StrictHostKeyChecking=no" -o "LogLevel=ERROR" -i key -r * ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}:api/ - name: restarting the backend run: | - ssh -o "StrictHostKeyChecking=no" -o "LogLevel=ERROR" -i key ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} "cd api/backend && docker build -t clyde/backend . && docker rm clyde_backend_prod -f || true && docker run --rm -d --name clyde_backend_prod -p 4000:8080 clyde/backend && docker image prune -f" + ssh -o "StrictHostKeyChecking=no" -o "LogLevel=ERROR" -i key ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} "cd api/backend && docker build -t clyde/backend . && docker rm clyde_backend_prod -f || true && docker run --rm -d -u $(id -u clyde):$(id -g clyde) -v /var/run/postgresql:/var/run/postgresql --name clyde_backend_prod -p 4000:8080 clyde/backend && docker image prune -f" - run: echo "The backend has been deployed. running at https://clyde.herisson.ovh/api" diff --git a/backend/src/main/java/ovh/herisson/Clyde/JdbcConfig.java b/backend/src/main/java/ovh/herisson/Clyde/JdbcConfig.java index c310d52..a60d41d 100644 --- a/backend/src/main/java/ovh/herisson/Clyde/JdbcConfig.java +++ b/backend/src/main/java/ovh/herisson/Clyde/JdbcConfig.java @@ -29,7 +29,7 @@ public class JdbcConfig { public DataSource psqlSourceProd(){ DriverManagerDataSource source = new DriverManagerDataSource(); source.setDriverClassName("org.postgresql.Driver"); - source.setUrl("jdbc:postgresql://localhost:5432/clyde"); + source.setUrl("jdbc:postgresql:clyde"); source.setUsername("clyde"); return source;