Skip to content

Commit

Permalink
using compose file 3
Browse files Browse the repository at this point in the history
  • Loading branch information
RamyAlshurafa committed Dec 17, 2023
1 parent 9fd9dc0 commit cbdffea
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 28 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/ec2-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ env:
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
AWS_PRIVATE_KEY: ${{ secrets.AWS_PRIVATE_KEY }}
VM_IP: ${{ secrets.VM_IP }}
ENV_FILE: ${{ secrets.ENV_FILE }}

jobs:
build:
Expand Down Expand Up @@ -74,6 +75,9 @@ jobs:
- name: Copy docker-compose file
run: |
scp -o StrictHostKeyChecking=no -i key.pem docker-compose.yml ${{ env.VM_IP }}:~/docker-compose.yml
- name: Create env file
run: |
ssh -o StrictHostKeyChecking=no -i key.pem ${{ env.VM_IP }} 'echo "${{ env.ENV_FILE }}" > ~/.env'
- name: Run docker-compose
run: |
ssh -o StrictHostKeyChecking=no -i key.pem ${{ env.VM_IP }} 'docker-compose up -d'
4 changes: 2 additions & 2 deletions config/database.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
const path = require("path");

module.exports = ({ env }) => {
const client = env("DATABASE_CLIENT", "postgres");
const client = "postgres";

const connections = {
postgres: {
connection: {
connectionString: env("DATABASE_URL"),
host: env("DATABASE_HOST", "localhost"),
port: env.int("DATABASE_PORT", 5432),
port: 5432,
database: env("DATABASE_NAME", "strapi"),
user: env("DATABASE_USERNAME", "strapi"),
password: env("DATABASE_PASSWORD", "strapi"),
Expand Down
24 changes: 12 additions & 12 deletions config/env/development/database.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
module.exports = ({ env }) => ({
connection: {
client: 'postgres',
connection: {
host: env('DATABASE_HOST', 'localhost'),
port: env.int('DATABASE_PORT', 5432),
database: env('DATABASE_NAME', 'strapi'),
user: env('DATABASE_USERNAME', 'strapi'),
password: env('DATABASE_PASSWORD', 'strapi'),
ssl: env.bool('DATABASE_SSL', false)
}
}
module.exports = ({ env }) => ({
connection: {
client: "postgres",
connection: {
host: env("DATABASE_HOST", "localhost"),
port: 5432,
database: env("DATABASE_NAME", "strapi"),
user: env("DATABASE_USERNAME", "strapi"),
password: env("DATABASE_PASSWORD", "strapi"),
ssl: env.bool("DATABASE_SSL", false),
},
},
});
24 changes: 12 additions & 12 deletions config/env/production/database.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
module.exports = ({ env }) => ({
connection: {
client: 'postgres',
connection: {
host: env('DATABASE_HOST', 'localhost'),
port: env.int('DATABASE_PORT', 5432),
database: env('DATABASE_NAME', 'strapi'),
user: env('DATABASE_USERNAME', 'strapi'),
password: env('DATABASE_PASSWORD', 'strapi'),
ssl: env.bool('DATABASE_SSL', false)
}
}
module.exports = ({ env }) => ({
connection: {
client: "postgres",
connection: {
host: env("DATABASE_HOST", "localhost"),
port: 5432,
database: env("DATABASE_NAME", "strapi"),
user: env("DATABASE_USERNAME", "strapi"),
password: env("DATABASE_PASSWORD", "strapi"),
ssl: env.bool("DATABASE_SSL", false),
},
},
});
2 changes: 0 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ services:
restart: unless-stopped
env_file: .env
environment:
DATABASE_CLIENT: ${DATABASE_CLIENT}
DATABASE_HOST: strapiDB
DATABASE_PORT: ${DATABASE_PORT}
DATABASE_NAME: ${DATABASE_NAME}
DATABASE_USERNAME: ${DATABASE_USERNAME}
DATABASE_PASSWORD: ${DATABASE_PASSWORD}
Expand Down

0 comments on commit cbdffea

Please sign in to comment.