Go to file
Zack 36499be26c
docs: test + deploy + environmental variables (#14)
* doc: test + deploy + environmental variables

* doc: local dev and testing(WIP)

* dev: set up local testing

* fix: ci: add DATABASE_URL env

* chore: update .env

* ci: fix

* dev: docker-compose-dev.yml

* ci: update

* ci: test env

* ci: add services

* ci: add services

* ci: update port

* ci: rename ci.yaml to rustlint.yaml

* ci: test

* ci: simplify tests

* ci: use cargo sqlx commands directly

* ci: fix: registered user

* ci: fix: test registered user creation

* ci: fix: test registered user creation - 2

* ci: fix: debug docker ci

* ci: fix: docker integration registered user

* ci: fix: docker integration registered user

---------

Co-authored-by: nathan <nathan@appflowy.io>
2023-09-07 15:29:39 +08:00
.github docs: test + deploy + environmental variables (#14) 2023-09-07 15:29:39 +08:00
.sqlx chore: create tables (#16) 2023-09-07 10:43:10 +08:00
build docs: test + deploy + environmental variables (#14) 2023-09-07 15:29:39 +08:00
cert fix: request fail caused by certificate issue 2023-03-15 09:32:23 +08:00
configuration docs: test + deploy + environmental variables (#14) 2023-09-07 15:29:39 +08:00
crates feat: refactor server collab (#15) 2023-09-06 18:22:40 +08:00
docker chore: create tables (#16) 2023-09-07 10:43:10 +08:00
migrations chore: create tables (#16) 2023-09-07 10:43:10 +08:00
src docs: test + deploy + environmental variables (#14) 2023-09-07 15:29:39 +08:00
tests docs: test + deploy + environmental variables (#14) 2023-09-07 15:29:39 +08:00
.dockerignore chore: create tables (#16) 2023-09-07 10:43:10 +08:00
.gitignore docs: test + deploy + environmental variables (#14) 2023-09-07 15:29:39 +08:00
Cargo.lock docs: test + deploy + environmental variables (#14) 2023-09-07 15:29:39 +08:00
Cargo.toml docs: test + deploy + environmental variables (#14) 2023-09-07 15:29:39 +08:00
LICENSE chore: add license 2023-07-28 21:05:27 +08:00
Makefile feat: Auth server integration (#9) 2023-09-04 11:23:40 +08:00
README.md docs: test + deploy + environmental variables (#14) 2023-09-07 15:29:39 +08:00
dev.env docs: test + deploy + environmental variables (#14) 2023-09-07 15:29:39 +08:00
docker-compose-dev.yml docs: test + deploy + environmental variables (#14) 2023-09-07 15:29:39 +08:00
docker-compose.yml docs: test + deploy + environmental variables (#14) 2023-09-07 15:29:39 +08:00
rustfmt.toml feat: ws connect (#3) 2023-05-08 19:03:50 +08:00

README.md

AppFlowy Cloud

  • Cloud Server for AppFlowy

Deployment

Environmental Variables before starting

  • you can set it explicitly(below) or in a .env file (use dev.env) as template
# authentication key, change this and keep the key safe and secret
GOTRUE_JWT_SECRET=secret_auth_pass

# enabled by default, if you dont want need email confirmation, set to false
GOTRUE_MAILER_AUTOCONFIRM=true

# if you enable mail confirmation, you need to set the SMTP configuration below
GOTRUE_SMTP_HOST=smtp.gmail.com
GOTRUE_SMTP_PORT=465
GOTRUE_SMTP_USER=email_sender@some_company.com
GOTRUE_SMTP_PASS=email_sender_password
GOTRUE_SMTP_ADMIN_EMAIL=comp_admin@@some_company.com

# Change 'localhost' to the public host of machine that is running on.
# This is for email confirmation link
API_EXTERNAL_URL=http://localhost:9998
  • additional settings can be modified in docker-compose.yml

Start Cloud Server

docker-compose up -d

Ports

Host Server is required to expose the following Ports:

  • 8000
  • 9998

Local Development

Pre-requisites

You'll need to install:

Configuration

  • copy the configurations from dev.env to .env
  • edit the .env as required (such as SMTP configurations)

Run the dependency servers

docker-compose --file docker-compose-dev.yml up -d

Install sqlx-cli

cargo install sqlx-cli

Run sqlx migration

sqlx database create
sqlx migrate run

Run the AppFlowy-Cloud server

cargo run

Run the tests

Verified user

  • Make sure you have registered a user and put into your .env file, else some test may fail
  • You may register the email defined in .env by running the following command, you may then click on the link sent to that email to complete registration
source .env
curl localhost:9998/signup \
    --data-raw '{"email":"'"$GOTRUE_REGISTERED_EMAIL"'","password":"'"$GOTRUE_REGISTERED_PASSWORD"'"}' \
    --header 'Content-Type: application/json'
  • Verify registration, you should get a token after running the command below:
source .env
curl localhost:9998/token?grant_type=password \
    --data-raw '{"email":"'"$GOTRUE_REGISTERED_EMAIL"'","password":"'"$GOTRUE_REGISTERED_PASSWORD"'"}' \
    --header 'Content-Type: application/json'

Test

cargo test