Skip to content

Commit 03bfaf0

Browse files
authored
Merge pull request #640 from dzcode-io/chore/cleanup-using-docker-compose
fix: fixed storage issue on VPS
2 parents 35b341a + deec340 commit 03bfaf0

File tree

2 files changed

+12
-18
lines changed

2 files changed

+12
-18
lines changed

api/oracle-cloud/deploy.ts

+6-17
Original file line numberDiff line numberDiff line change
@@ -52,24 +52,13 @@ const appPath = "~/app";
5252
const sshPrefix =
5353
"ssh -o StrictHostKeyChecking=no " + (sshKeyPath ? `-i ${sshKeyPath} ` : "") + sshServer + " ";
5454

55-
// todo-ZM: let docker-compose handle deletion of old containers
56-
// Check for existing containers
57-
logs = execSync(sshPrefix + '"sudo docker ps -aq"');
58-
59-
if (String(logs)) {
60-
// stop containers
61-
console.log("⚠️ Stopping all containers ...");
62-
logs = execSync(sshPrefix + '"sudo docker stop \\$(sudo docker ps -aq)"');
63-
console.log(String(logs));
55+
console.log("⚠️ Cleaning up old containers ...");
56+
logs = execSync(sshPrefix + '"sudo docker container prune --force"');
57+
console.log(String(logs));
6458

65-
// delete containers
66-
console.log("⚠️ Deleting all containers ...");
67-
logs = execSync(sshPrefix + '"sudo docker rm \\$(sudo docker ps -aq)"');
68-
console.log(String(logs));
69-
console.log("✅ All containers stopped");
70-
} else {
71-
console.log("⏩ No container found, skipping stopping containers.");
72-
}
59+
console.log("⚠️ Cleaning up old images ...");
60+
logs = execSync(sshPrefix + '"sudo docker image prune --force"');
61+
console.log(String(logs));
7362

7463
console.log("⚠️ Deleting old code ...");
7564
logs = execSync(sshPrefix + '"rm -f -r ' + appPath + '"');

api/oracle-cloud/docker-compose.yml

+6-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ services:
1313
build: "."
1414
ports:
1515
- "7070:7070"
16+
depends_on:
17+
postgres:
18+
condition: service_started
19+
meilisearch:
20+
condition: service_started
1621
env_file:
1722
- /home/ubuntu/app-env/api.env
1823
volumes:
@@ -28,7 +33,7 @@ services:
2833
POSTGRES_HOST_AUTH_METHOD: trust
2934
POSTGRES_DB: db
3035
meilisearch:
31-
image: getmeili/meilisearch:latest
36+
image: getmeili/meilisearch:v1.11.3
3237
ports:
3338
- "7700:7700"
3439
volumes:

0 commit comments

Comments
 (0)