From 630c291274d08f23525f5b3d6205c4f0da0fc51f Mon Sep 17 00:00:00 2001
From: Thomasdelecluse <81568452+Thomasdelecluse@users.noreply.github.com>
Date: Fri, 16 Jun 2023 14:26:30 +0200
Subject: [PATCH 1/6] feat: test recipe cicd
---
.github/workflows/on-pullrequest-recipe.yml | 1 +
1 file changed, 1 insertion(+)
diff --git a/.github/workflows/on-pullrequest-recipe.yml b/.github/workflows/on-pullrequest-recipe.yml
index ac656af..76c1f84 100644
--- a/.github/workflows/on-pullrequest-recipe.yml
+++ b/.github/workflows/on-pullrequest-recipe.yml
@@ -1,5 +1,6 @@
name: Java with Spring CI
+
on:
pull_request:
branches:
From 5656e14ac2d55f35bfb2936cf009859666e03074 Mon Sep 17 00:00:00 2001
From: Thomasdelecluse <81568452+Thomasdelecluse@users.noreply.github.com>
Date: Fri, 16 Jun 2023 15:33:09 +0200
Subject: [PATCH 2/6] feat: add deploy
---
.github/workflows/on-pullrequest-recipe.yml | 27 +++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/.github/workflows/on-pullrequest-recipe.yml b/.github/workflows/on-pullrequest-recipe.yml
index 76c1f84..cfb76c5 100644
--- a/.github/workflows/on-pullrequest-recipe.yml
+++ b/.github/workflows/on-pullrequest-recipe.yml
@@ -26,4 +26,31 @@ jobs:
with:
push: true
tags: ghcr.io/thomasdelecluse/api_todolist_cicd:latest
+ deploy:
+ needs: docker
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout Repository
+ uses: actions/checkout@v3
+
+ - name: SSH to Server
+ uses: appleboy/ssh-action@master
+ with:
+ host: 34.229.90.67
+ username: ubuntu
+ key: ${{ secrets.SSH_PRIVATE_KEY }}
+
+ # Optional: If you need to execute specific commands on the server
+ script: |
+ echo "Connected to the server via SSH"
+ # Add your desired commands here
+ # Example: npm run build
+
+ docker login ghcr.io -u thomasdelecluse -p ${{ secrets.TOKEN }}
+ docker stop api-todolist
+ docker rm api-todolist
+ docker pull ghcr.io/thomasdelecluse/api_todolist_cicd:latest
+ docker run -d --name api-todolist -p 8080:8080 ghcr.io/thomasdelecluse/api_todolist_cicd:latest
+ docker run --name mariadbdatabase -e MYSQL_ROOT_PASSWORD=pass -p 3306:3306 -d mariadb:latest
From 5061671539c2b3370e9a6aad5d4cdd562686696e Mon Sep 17 00:00:00 2001
From: Thomasdelecluse <81568452+Thomasdelecluse@users.noreply.github.com>
Date: Fri, 16 Jun 2023 15:35:27 +0200
Subject: [PATCH 3/6] feat: add space
---
.github/workflows/on-pullrequest-recipe.yml | 1 +
1 file changed, 1 insertion(+)
diff --git a/.github/workflows/on-pullrequest-recipe.yml b/.github/workflows/on-pullrequest-recipe.yml
index cfb76c5..d3e8e25 100644
--- a/.github/workflows/on-pullrequest-recipe.yml
+++ b/.github/workflows/on-pullrequest-recipe.yml
@@ -47,6 +47,7 @@ jobs:
# Add your desired commands here
# Example: npm run build
+
docker login ghcr.io -u thomasdelecluse -p ${{ secrets.TOKEN }}
docker stop api-todolist
docker rm api-todolist
From f831c0f1cea1e75578a00d97752616b49b6593b4 Mon Sep 17 00:00:00 2001
From: Thomasdelecluse <81568452+Thomasdelecluse@users.noreply.github.com>
Date: Fri, 16 Jun 2023 16:07:32 +0200
Subject: [PATCH 4/6] feat: ip server fix
---
.github/workflows/on-pullrequest-recipe.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/on-pullrequest-recipe.yml b/.github/workflows/on-pullrequest-recipe.yml
index d3e8e25..74ad4a9 100644
--- a/.github/workflows/on-pullrequest-recipe.yml
+++ b/.github/workflows/on-pullrequest-recipe.yml
@@ -37,7 +37,7 @@ jobs:
- name: SSH to Server
uses: appleboy/ssh-action@master
with:
- host: 34.229.90.67
+ host: 34.200.26.248
username: ubuntu
key: ${{ secrets.SSH_PRIVATE_KEY }}
From ba7088478df361255456714b0ea5406def3283aa Mon Sep 17 00:00:00 2001
From: Thomasdelecluse <81568452+Thomasdelecluse@users.noreply.github.com>
Date: Fri, 16 Jun 2023 16:14:55 +0200
Subject: [PATCH 5/6] feat: remove maridb from cicd
---
.github/workflows/on-pullrequest-recipe.yml | 1 -
1 file changed, 1 deletion(-)
diff --git a/.github/workflows/on-pullrequest-recipe.yml b/.github/workflows/on-pullrequest-recipe.yml
index 74ad4a9..a33eeb9 100644
--- a/.github/workflows/on-pullrequest-recipe.yml
+++ b/.github/workflows/on-pullrequest-recipe.yml
@@ -53,5 +53,4 @@ jobs:
docker rm api-todolist
docker pull ghcr.io/thomasdelecluse/api_todolist_cicd:latest
docker run -d --name api-todolist -p 8080:8080 ghcr.io/thomasdelecluse/api_todolist_cicd:latest
- docker run --name mariadbdatabase -e MYSQL_ROOT_PASSWORD=pass -p 3306:3306 -d mariadb:latest
From 7f1144b3dcaea3dc92aef896029f0da6d545bb4a Mon Sep 17 00:00:00 2001
From: Thomasdelecluse <81568452+Thomasdelecluse@users.noreply.github.com>
Date: Wed, 15 Nov 2023 16:45:36 +0100
Subject: [PATCH 6/6] feat: db postgres
---
pom.xml | 5 +++++
src/main/resources/application.properties | 16 +++++++++++-----
2 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/pom.xml b/pom.xml
index 26d4bad..d693709 100644
--- a/pom.xml
+++ b/pom.xml
@@ -30,6 +30,11 @@
h2
runtime
+
+ org.postgresql
+ postgresql
+ runtime
+
org.springframework.boot
spring-boot-devtools
diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties
index c5d4daa..9219f6a 100644
--- a/src/main/resources/application.properties
+++ b/src/main/resources/application.properties
@@ -1,7 +1,13 @@
-spring.datasource.url=jdbc:h2:mem:testdb
-spring.datasource.driverClassName=org.h2.Driver
-spring.datasource.username=sa
-spring.datasource.password=
-spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
+#spring.datasource.url=jdbc:h2:mem:testdb
+#spring.datasource.driverClassName=org.h2.Driver
+#spring.datasource.username=sa
+#spring.datasource.password=
+#spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
+
+spring.datasource.url=jdbc:postgresql://postgres:5432/db
+spring.datasource.username=admin
+spring.datasource.password=admin
+spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect
+spring.jpa.hibernate.ddl-auto=update
server.port=8080
\ No newline at end of file