Skip to content

Commit

Permalink
Add SQL server database
Browse files Browse the repository at this point in the history
  • Loading branch information
kostakupresak committed Oct 13, 2023
1 parent 08b636e commit 3eb95c9
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .env.default
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
DATABASE_PORT=
DATABASE_PASSWORD=
38 changes: 38 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: CI/CD
on:
push:
branches:
- main
jobs:
build_and_deploy:
if: ${{ github.ref == 'refs/heads/main' }}
runs-on: ubuntu-latest
steps:
- name: Checkout main
uses: actions/checkout@main
- name: Replace tokens
uses: cschleiden/replace-tokens@v1.1
with:
tokenPrefix: '#{'
tokenSuffix: '}#'
files: '["docker-compose.production.yaml"]'
env:
DATABASE_PORT: "${{ secrets.DATABASE_PORT }}"
DATABASE_PASSWORD: "${{ secrets.DATABASE_PASSWORD }}"
- name: Copy docker compose file via SSH password
uses: appleboy/scp-action@master
with:
host: ${{ secrets.SERVER_HOST }}
username: ${{ secrets.SERVER_USERNAME }}
password: ${{ secrets.SERVER_PASSWORD }}
port: 22
source: "docker-compose.production.yaml"
target: "~/Projects/slobodanemacenu/"
- name: Starting docker compose file via SSH
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SERVER_HOST }}
username: ${{ secrets.SERVER_USERNAME }}
password: ${{ secrets.SERVER_PASSWORD }}
port: 22
script: docker compose -f ~/Projects/slobodanemacenu/docker-compose.production.yaml up --build -d
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
**/.env
19 changes: 19 additions & 0 deletions docker-compose.production.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
version: "3.9"

services:
database:
image: mcr.microsoft.com/mssql/server:2022-latest
container_name: "slobodanemacenu_database"
user: root
ports:
- "#{DATABASE_PORT}#:1433"
environment:
- ACCEPT_EULA=Y
- MSSQL_SA_PASSWORD=#{DATABASE_PASSWORD}#
volumes:
- slobodanemacenu_database_data:/var/opt/mssql/data
restart: always
env_file:
- .env
volumes:
slobodanemacenu_database_data:
19 changes: 19 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
version: "3.9"

services:
database:
image: mcr.microsoft.com/mssql/server:2022-latest
container_name: "slobodanemacenu_database"
user: root
ports:
- "${DATABASE_PORT}:1433"
environment:
- ACCEPT_EULA=Y
- MSSQL_SA_PASSWORD=${DATABASE_PASSWORD}
volumes:
- slobodanemacenu_database_data:/var/opt/mssql/data
restart: always
env_file:
- .env
volumes:
slobodanemacenu_database_data:

0 comments on commit 3eb95c9

Please sign in to comment.