zf

zenflows testing
git clone https://s.sonu.ch/~srfsh/zf.git
Log | Files | Refs | Submodules | README | LICENSE

commit 594aad52764284fbe6cb8986969aa11aa38fb332
parent e66072d66a6de1fbc5b3ae25618cf622be88601f
Author: srfsh <dev@srf.sh>
Date:   Fri, 14 Oct 2022 13:01:09 +0300

Merge branch 'master' into srfsh/filter

Diffstat:
MREADME.md | 7++++---
Mconf/buildtime.exs | 4+++-
Mdevop/.docker-compose.templ | 2+-
Mmann | 9++-------
Msrc/zenflows/application.ex | 7+++++++
5 files changed, 17 insertions(+), 12 deletions(-)

diff --git a/README.md b/README.md @@ -69,17 +69,18 @@ To start using Zenflows with native-to-host Elixir, PostgreSQL, and Restroom ins 1. Run `./mann env.setup` to generate the configuration file, `conf/env.sh`. 2. Edit `conf/env.sh` to suit your needs. Read the [Configuration Guide](docs/configuration-guide.md) for more info. 3. Run `./mann dep.setup` to install dependencies. -4. Run `./mann db.setup` to setup the database and run the migrations. 5. Run `./mann serve` to start the application. 6. Head over to [`localhost:4000/play`](http://localhost:4000/play) for the GraphiQL playground. 7. Use the URL `http://localhost:4000/api` in case if you'd like to use your own GraphQL client. To start using Zenflows with docker(-compose): +1. Run `./mann devop.serve` to generate the docker-compose file (automatically filled) and start the application. + +If you want to edit the generated docker-copmose file: + 1. Run `./mann devop.setup` to generate the docker-copmose file, `devop/docker-compose.yml`. 2. Edit `devop/docker-compose.yml` to suit your needs. Read the [Configuration Guide](docs/configuration-guide.md) for more info. -2. Run `./mann devop.db.setup` to setup the database and run the migrations - (run it multiple times if it fails due to connection issues). 3. Run `./mann devop.serve` to start the application. **[🔝 back to top](#toc)** diff --git a/conf/buildtime.exs b/conf/buildtime.exs @@ -24,7 +24,9 @@ config :zenflows, ecto_repos: [Repo] config :zenflows, Repo, migration_primary_key: [type: :binary_id], migration_foreign_key: [type: :binary_id], - migration_timestamps: [type: :timestamptz, inserted_at: false] + migration_timestamps: [type: :timestamptz, inserted_at: false], + queue_target: 60_000 # 1 min + if config_env() == :test do config :zenflows, Repo, diff --git a/devop/.docker-compose.templ b/devop/.docker-compose.templ @@ -40,7 +40,7 @@ services: ROOM_PORT: &room_port 3000 ROOM_SALT: @ROOM_SALT - GQL_AUTH_CALLS: true + GQL_AUTH_CALLS: "true" GQL_DEF_PAGE_SIZE: 50 GQL_MAX_PAGE_SIZE: 100 depends_on: diff --git a/mann b/mann @@ -60,7 +60,6 @@ main() { devop.setup) shift ; cmd_devop_setup "$@" ;; devop.serve) shift ; cmd_devop_serve "$@" ;; devop.comp) shift ; cmd_devop_comp "$@" ;; - devop.db.setup) shift ; cmd_devop_db_setup "$@" ;; devop.build) shift ; cmd_devop_build "$@" ;; devop.run) shift ; cmd_devop_run "$@" ;; devop.exec) shift ; cmd_devop_exec "$@" ;; @@ -184,7 +183,7 @@ cmd_env_setup() { key=$(openssl rand -hex 64) salt=$(openssl rand -hex 64) sed 's,@ADMIN_KEY,'"$key"', ; s,@ROOM_SALT,'"$salt"',' conf/.env.templ >conf/env.sh - warn "the 'conf/env.sh' file is generated, please edit it to suit your needs" + warn "the 'conf/env.sh' file is generated; please edit it to suit your needs" fi } @@ -274,7 +273,7 @@ cmd_devop_setup() { sed 's,@ADMIN_KEY,'"$admin_key"', ; s,@DB_PASS,'"$db_pass"', ; s,@ROOM_SALT,'"$room_salt"',' devop/.docker-compose.templ >devop/docker-compose.yml - warn "the 'devop/docker-compose.yml' file is generated, please edit it to suit your needs" + warn "the 'devop/docker-compose.yml' file is generated; please edit it to suit your needs" fi } @@ -287,10 +286,6 @@ cmd_devop_comp() { docker-compose -p zenflows -f devop/docker-compose.yml "$@" } -cmd_devop_db_setup() { - cmd_devop_comp run --service-ports --rm srv eval 'Zenflows.Reltask.migrate()' -} - cmd_devop_build() { cmd_devop_comp build "$@" } diff --git a/src/zenflows/application.ex b/src/zenflows/application.ex @@ -23,6 +23,8 @@ use Application def start(_type, _args) do print_header() + migrate() + children = [ Zenflows.DB.Repo, Zenflows.InstVars.Domain, @@ -56,4 +58,9 @@ defp print_header() do """) end end + +defp migrate() do + unless System.get_env("NOMIGRATE"), + do: Zenflows.Reltask.migrate() +end end