Skip to content

Commit

Permalink
reverting to stable one
Browse files Browse the repository at this point in the history
  • Loading branch information
ehsan-g committed Nov 29, 2023
1 parent 3037221 commit b61b462
Show file tree
Hide file tree
Showing 46 changed files with 251 additions and 773 deletions.
32 changes: 16 additions & 16 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ name: "CI/CD"
env:
REGISTRY: ghcr.io
DEVELOPMENT: dev
STAGING: staging
STAGING: stag
PRODUCTION: prod
MAIN_BRANCH: master
DEV_DOMAIN: api.d.sayapp.company
STAGING_DOMAIN: api.s.sayapp.company
STAGE_DOMAIN: api.s.sayapp.company
PROD_DOMAIN: api.sayapp.company
TARGET_LAYER: prod
TEST_TARGET_LAYER: development
DEV_STACK_NAME: say-dev-backend
STAGING_STACK_NAME: say-staging-backend
STAGE_STACK_NAME: say-stag-backend
PROD_STACK_NAME: say-backend
DOCKER_COMPOSE_PATH: docker-compose.yml
DOCKER_STACK_PATH: docker-stack.yml
Expand Down Expand Up @@ -53,7 +53,7 @@ jobs:
- name: Set Staging Envars
if: ${{ env.REF == 'master' }}
run: |
echo "ENVIRONMENT=staging" >> $GITHUB_ENV
echo "ENVIRONMENT=stag" >> $GITHUB_ENV
- name: Set Production Envars
if: ${{ env.REF == 'release' }}
Expand Down Expand Up @@ -205,40 +205,40 @@ jobs:

environment:
name: Staging
url: https://${{ env.STAGING_DOMAIN }}
url: https://${{ env.STAGE_DOMAIN }}

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

- name: Set Envars
run: |
echo "STACK_FILE=docker-stack-${{ env.STAGING_STACK_NAME }}-${{ github.sha }}.yml" >> $GITHUB_ENV
echo "STACK_FILE=docker-stack-${{ env.STAGE_STACK_NAME }}-${{ github.sha }}.yml" >> $GITHUB_ENV
- name: Prepare Stack File
run: >
ENVIRONMENT=${{ env.STAGING }} DOMAIN=${{ env.STAGING_DOMAIN }} CONTAINER_IMAGE=${IMAGE_ID} STACK_NAME=${{ env.STAGING_STACK_NAME }}
ENVIRONMENT=${{ env.STAGING }} DOMAIN=${{ env.STAGE_DOMAIN }} CONTAINER_IMAGE=${IMAGE_ID} STACK_NAME=${{ env.STAGE_STACK_NAME }}
docker-compose -f ${{ env.DOCKER_COMPOSE_PATH }} -f ${{ env.DOCKER_STACK_PATH }} config
> ${{ env.STACK_FILE }}
- name: Move Stack File to Server
uses: appleboy/[email protected]
with:
host: ${{ secrets.STAGING_SERVER_ADDR }}
username: ${{ secrets.STAGING_SERVER_USER }}
key: ${{ secrets.STAGING_SSH_PRIVATE_KEY }}
port: ${{ secrets.STAGING_SERVER_PORT }}
host: ${{ secrets.STAGE_SERVER_ADDR }}
username: ${{ secrets.STAGE_SERVER_USER }}
key: ${{ secrets.STAGE_SSH_PRIVATE_KEY }}
port: ${{ secrets.STAGE_SERVER_PORT }}
source: ${{ env.STACK_FILE }}
target: "/tmp"

- name: Deploy Stack
uses: appleboy/[email protected]
with:
host: ${{ secrets.STAGING_SERVER_ADDR }}
username: ${{ secrets.STAGING_SERVER_USER }}
key: ${{ secrets.STAGING_SSH_PRIVATE_KEY }}
port: ${{ secrets.STAGING_SERVER_PORT }}
script: docker stack deploy --prune --resolve-image=changed --with-registry-auth -c /tmp/${{ env.STACK_FILE }} ${{ env.STAGING_STACK_NAME }}
host: ${{ secrets.STAGE_SERVER_ADDR }}
username: ${{ secrets.STAGE_SERVER_USER }}
key: ${{ secrets.STAGE_SSH_PRIVATE_KEY }}
port: ${{ secrets.STAGE_SERVER_PORT }}
script: docker stack deploy --prune --resolve-image=changed --with-registry-auth -c /tmp/${{ env.STACK_FILE }} ${{ env.STAGE_STACK_NAME }}

deploy_production:
name: Deploy to Production Server
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Backend of SAY App and Panel

[![CI/CD](https://github.com/SAY-DAO/backend/actions/workflows/pipeline.yml/badge.svg?branch=release)](https://github.com/SAY-DAO/backend/actions/workflows/pipeline.yml)
[![Build, Test and Deploy](https://github.com/SAY-DAO/backend/actions/workflows/pipeline.yml/badge.svg)](https://github.com/SAY-DAO/backend/actions/workflows/pipeline.yml)
[![codecov](https://codecov.io/gh/SAY-DAO/backend/branch/master/graph/badge.svg?token=RXJ4EXVIR0)](https://codecov.io/gh/SAY-DAO/backend)

### Requirements
Expand Down
2 changes: 1 addition & 1 deletion alembic.ini
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ script_location = alembic
# are written from script.py.mako
# output_encoding = utf-8

sqlalchemy.url = postgresql://postgres:postgres@localhost/say
sqlalchemy.url = postgresql://postgres:postgres@localhost/say_test


[post_write_hooks]
Expand Down
6 changes: 2 additions & 4 deletions alembic/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import sys
from logging.config import fileConfig

from sqlalchemy import engine_from_config
from sqlalchemy import pool
from flask import json
from sqlalchemy import engine_from_config, pool

from alembic import context

Expand All @@ -24,7 +24,6 @@
# target_metadata = mymodel.Base.metadata
from say.models import base


target_metadata = base.metadata

# other values from the config, defined by the needs of env.py,
Expand All @@ -34,7 +33,6 @@

from say.config import configs


config.set_main_option('sqlalchemy.url', configs.postgres_url)


Expand Down
2 changes: 1 addition & 1 deletion alembic/versions/23554e6d0034_.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

# revision identifiers, used by Alembic.
revision = '23554e6d0034'
down_revision = '389f9919c78d'
down_revision = 'fa7d127f259b'
branch_labels = None
depends_on = None

Expand Down
248 changes: 0 additions & 248 deletions alembic/versions/389f9919c78d_.py

This file was deleted.

Loading

0 comments on commit b61b462

Please sign in to comment.