Skip to content

Commit

Permalink
Werking on deploys
Browse files Browse the repository at this point in the history
  • Loading branch information
mikhomak committed Mar 5, 2024
1 parent e76472f commit dfede48
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 5 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/prod_server.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Build and deploy rust graphql server
on:
push:
branches:
- main

env:
SQLX_OFFLINE: true

jobs:
build:
runs-on: self-hosted
environment: prod

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Cache dependencies
uses: actions/cache@v3
with:
path: |
~/.cargo
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-

- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable

- name: Deploy
working-directory: ./cookingd-server
run: |
cd ~
docker-compose down
docker-compose build
docker-compose up -d
1 change: 0 additions & 1 deletion cookingd-front/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { DefaultApolloClient } from '@vue/apollo-composable'
import { createPinia } from 'pinia'
import createUploadLink from "apollo-upload-client/createUploadLink.mjs";
import { useUserStore } from '@/stores/useUserStore'
import process from 'process'

const cache = new InMemoryCache()

Expand Down
3 changes: 2 additions & 1 deletion cookingd-server/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ services:
POSTGRES_DB: ${POSTGRES_DB}
ports:
- "5432:5432"

volumes:
- db:/var/lib/postgresql/data

volumes:
db:
Expand Down
4 changes: 4 additions & 0 deletions cookingd-server/scripts/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#! /bin/bash
source ~/.bashrc

cargo build --release
6 changes: 3 additions & 3 deletions cookingd-server/scripts/init-db.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

docker run \
--name postgres \
-e POSTGRES_USER=postgres \
-e POSTGRES_PASSWORD=password \
-e POSTGRES_DB=cookingd \
-e POSTGRES_USER=$POSTGRES_USER \
-e POSTGRES_PASSWORD=$POSTGRES_PASSWORD \
-e POSTGRES_DB=$POSTGRES_DB \
-p 5432:5432 \
-d postgres:alpine

0 comments on commit dfede48

Please sign in to comment.