Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.
Dart blogconfluence-alternativecontent-managementcontent-servicesdocumentationflutternote-takingnotion-alternativeproject-managementtask-managementteam-collaborationwiki
add docker-compose
appflowy8f582faffecc
diff --git a/.github/workflows/backend_general.yml b/.github/workflows/backend_general.ymlindex f337545353..5f78a1af57 100644--- a/.github/workflows/backend_general.yml+++ b/.github/workflows/backend_general.yml@@ -3,9 +3,6 @@ name: Backendon:push:branches: [ main ]- paths:- - 'backend'- - 'shared-lib'pull_request:branches: [ main ]@@ -155,5 +152,18 @@ jobs:- run: cargo clippy -- -D warningsworking-directory: backend/+ fmt:+ name: Rustfmt+ runs-on: ubuntu-latest+ steps:+ - uses: actions/checkout@v2+ - uses: actions-rs/toolchain@v1+ with:+ toolchain: nightly+ override: true+ - run: rustup component add rustfmt+ working-directory: backend/+ - run: cargo fmt --all -- --check+ working-directory: backend/diff --git a/backend/Makefile b/backend/Makefiledeleted file mode 100644index 6828ac6db4..0000000000--- a/backend/Makefile+++ /dev/null@@ -1,3 +0,0 @@-include scripts/database/database.mk--.PHONY: init_postgres init_database add_migrations run_migrations reset_db echo_db_url\ No newline at end of filediff --git a/backend/docker-compose.yml b/backend/docker-compose.ymlnew file mode 100644index 0000000000..6998f1153c--- /dev/null+++ b/backend/docker-compose.yml@@ -0,0 +1,18 @@+version: '3'+services:+ backend:+ build:+ context: .+ dockerfile: Dockerfile+ depends_on:+ - db+ ports:+ - "8000:8000"+ db:+ image: 'postgres:14'+ environment:+ POSTGRES_USER: "${POSTGRES_USER}"+ POSTGRES_DB: "${POSTGRES_DB}"+ POSTGRES_PASSWORD: "${POSTGRES_PASSWORD}"+ ports:+ - '${DB_PORT}:5432'\ No newline at end of filediff --git a/backend/scripts/Makefile b/backend/scripts/Makefileindex 1e44f51383..02128967ac 100644--- a/backend/scripts/Makefile+++ b/backend/scripts/Makefile@@ -1,14 +1,11 @@-#.EXPORT_ALL_VARIABLES:-#export DB_USER=postgres-#export DB_PASSWORD=password-#export DB_NAME=flowy-#export DB_PORT=5433-#export DATABASE_URL=postgres://${DB_USER}:${DB_PASSWORD}@localhost:${DB_PORT}/${DB_NAME}-#export DB_HOST = "localhost"+.PHONY: init_database add_migrations run_migrations reset_dbinit_database:${ROOT}/init_database.sh+run_docker:+ source $(shell pwd)/env.sh && docker-compose up -d db && docker-compose up -d backend+reset_db:#diesel database resetsqlx database reset@@ -22,6 +19,4 @@ run_migrations:# diesel migration runsqlx migrate run-echo_db_url:- echo ${DATABASE_URL}diff --git a/backend/scripts/env.sh b/backend/scripts/env.shnew file mode 100644index 0000000000..8c9d5db3d3--- /dev/null+++ b/backend/scripts/env.sh@@ -0,0 +1,9 @@+#!/bin/bash++export DB_USER="${POSTGRES_USER:=postgres}"+export DB_PASSWORD="${POSTGRES_PASSWORD:=password}"+export DB_PORT="${POSTGRES_PORT:=5433}"+export DB_HOST="${POSTGRES_HOST:=localhost}"+export DB_NAME="${POSTGRES_DB:=flowy}"++export DATABASE_URL=postgres://${DB_USER}:${DB_PASSWORD}@localhost:${DB_PORT}/${DB_NAME}\ No newline at end of filediff --git a/backend/scripts/init_database.sh b/backend/scripts/init_database.shindex d1ed0f10f0..712bdacc10 100755--- a/backend/scripts/init_database.sh+++ b/backend/scripts/init_database.sh@@ -18,11 +18,7 @@ if ! [ -x "$(command -v sqlx)" ]; thenexit 1fi-DB_USER="${POSTGRES_USER:=postgres}"-DB_PASSWORD="${POSTGRES_PASSWORD:=password}"-DB_PORT="${POSTGRES_PORT:=5433}"-DB_HOST="${POSTGRES_HOST:=localhost}"-DB_NAME="${POSTGRES_DB:=flowy}"+source ./env.shif [[ -z "${SKIP_DOCKER}" ]]then