2024-01-08 17:17:48 +00:00
|
|
|
---
|
|
|
|
version: "3"
|
|
|
|
vars:
|
|
|
|
CURRENT_BRANCH:
|
|
|
|
sh: "git rev-parse --abbrev-ref HEAD"
|
|
|
|
shopt:
|
|
|
|
- "globstar"
|
|
|
|
dotenv:
|
|
|
|
- ".env"
|
|
|
|
tasks:
|
2024-01-08 18:06:07 +00:00
|
|
|
credentials:
|
|
|
|
desc: "Generate credentials file"
|
|
|
|
cmds:
|
|
|
|
- "cp --no-clobber config/credentials.yml.enc.ci config/credentials.yml.enc"
|
|
|
|
sources:
|
|
|
|
- "config/credentials.yml.enc.ci"
|
|
|
|
generates:
|
|
|
|
- "config/credentials.yml.enc"
|
2024-01-08 17:17:48 +00:00
|
|
|
env:
|
|
|
|
desc: "Install the .env file"
|
|
|
|
cmds:
|
2024-01-08 17:58:19 +00:00
|
|
|
- "test -f .env || cp .env.example .env"
|
2024-01-08 17:38:21 +00:00
|
|
|
- ": == Environment vars have changed, please review and edit =="
|
2024-01-08 17:17:48 +00:00
|
|
|
- "diff -auN --color .env.example .env"
|
|
|
|
sources:
|
|
|
|
- ".env.example"
|
|
|
|
generates:
|
|
|
|
- ".env"
|
2024-01-08 17:38:44 +00:00
|
|
|
gems:
|
|
|
|
desc: "Install gems"
|
2024-01-08 18:06:07 +00:00
|
|
|
deps:
|
|
|
|
- "env"
|
|
|
|
- "credentials"
|
2024-01-08 17:38:44 +00:00
|
|
|
cmds:
|
2024-01-08 18:26:19 +00:00
|
|
|
- "{{.HAINISH}} bundle"
|
2024-01-08 17:38:44 +00:00
|
|
|
sources:
|
|
|
|
- "Gemfile"
|
|
|
|
generates:
|
|
|
|
- "Gemfile.lock"
|
2024-01-08 17:40:05 +00:00
|
|
|
clean:
|
|
|
|
desc: "Clean"
|
|
|
|
cmds:
|
|
|
|
- "rm -rf _sites/test-* _deploy/test-* log/*.log tmp/cache tmp/letter_opener tmp/miniprofiler tmp/storage"
|
2024-01-08 17:58:48 +00:00
|
|
|
node-modules:
|
|
|
|
desc: "Install Node modules"
|
|
|
|
cmds:
|
2024-01-08 18:26:19 +00:00
|
|
|
- "{{.HAINISH}} yarn"
|
2024-01-08 17:58:48 +00:00
|
|
|
sources:
|
|
|
|
- "package.json"
|
|
|
|
- "yarn.lock"
|
|
|
|
status:
|
|
|
|
- "test -d node_modules"
|
2024-01-08 18:07:59 +00:00
|
|
|
assets:
|
|
|
|
desc: "Generate assets"
|
|
|
|
deps:
|
|
|
|
- "node-modules"
|
|
|
|
- "gems"
|
|
|
|
cmds:
|
|
|
|
- "git lfs fetch"
|
|
|
|
- "git lfs checkout"
|
2024-01-08 18:26:19 +00:00
|
|
|
- "{{.HAINISH}} RAILS_ENV=production bundle exec rails webpacker:clobber"
|
|
|
|
- "{{.HAINISH}} RAILS_ENV=production bundle exec rails assets:precompile"
|
|
|
|
- "{{.HAINISH}} RAILS_ENV=production bundle exec rails assets:clean"
|
2024-01-08 18:07:59 +00:00
|
|
|
sources:
|
|
|
|
- "package.json"
|
|
|
|
- "yarn.lock"
|
|
|
|
- "app/assets/**/*"
|
|
|
|
- "app/javascript/**/*"
|
|
|
|
generates:
|
|
|
|
- "public/packs/manifest.json"
|
2024-01-08 18:39:32 +00:00
|
|
|
hosts:
|
|
|
|
desc: "Local DNS resolution for hostnames"
|
|
|
|
interactive: true
|
|
|
|
cmds:
|
|
|
|
- "echo -e \"127.0.0.1 panel.{{.SUTTY}} api.{{.SUTTY}} postgresql.{{.SUTTY}}\" | sudo tee -a /etc/hosts"
|
|
|
|
- "echo -e \"::1 panel.{{.SUTTY}} api.{{.SUTTY}} postgresql.{{.SUTTY}}\" | sudo tee -a /etc/hosts"
|
|
|
|
status:
|
|
|
|
- "grep -q \" panel.{{.SUTTY}} \" /etc/hosts"
|
2024-01-08 19:21:22 +00:00
|
|
|
database-init:
|
|
|
|
desc: "Database install"
|
|
|
|
deps:
|
|
|
|
- "env"
|
|
|
|
cmds:
|
|
|
|
- "{{.HAINISH}} /usr/bin/initdb --locale en_US.utf8 -E UTF8 -D /var/lib/postgresql/{{.PGVER}}/data"
|
|
|
|
- "echo \"host all all samenet trust\" >> ../hain/var/lib/postgresql/{{.PGVER}}/data/pg_hba.conf"
|
|
|
|
- "echo \"listen_addresses = '*'\" >> ../hain/var/lib/postgresql/{{.PGVER}}/data/postgresql.conf"
|
|
|
|
- "echo \"external_pid_file = '{{.PGPID}}'\" >> ../hain/var/lib/postgresql/{{.PGVER}}/data/postgresql.conf"
|
|
|
|
status:
|
|
|
|
- "test -d ../hain/var/lib/postgresql/{{.PGVER}}/data"
|
|
|
|
- "test -f ../hain/var/lib/postgresql/{{.PGVER}}/data/postgresql.conf"
|
|
|
|
database:
|
|
|
|
desc: "Database"
|
|
|
|
deps:
|
|
|
|
- "database-init"
|
|
|
|
cmds:
|
|
|
|
- "{{.HAINISH}} daemonize -c /var/lib/postgresql/{{.PGVER}}/data /usr/bin/postgres -D /var/lib/postgresql/{{.PGVER}}/data"
|
|
|
|
status:
|
|
|
|
- "test -f ../hain{{.PGPID}}"
|
|
|
|
- "pgrep -F ../hain{{.PGPID}}"
|
2024-01-08 19:55:58 +00:00
|
|
|
prepare:
|
|
|
|
desc: "Create database or run pending migrations"
|
|
|
|
deps:
|
|
|
|
- "database"
|
|
|
|
cmds:
|
|
|
|
- "{{.HAINISH}} bundle exec rails db:prepare"
|
|
|
|
serve:
|
|
|
|
desc: "Run Rails development server"
|
|
|
|
deps:
|
|
|
|
- "prepare"
|
|
|
|
- "gems"
|
|
|
|
cmds:
|
|
|
|
- ": == Development server running at https://panel.{{.SUTTY_WITH_PORT}} =="
|
|
|
|
- "{{.HAINISH}} bundle exec rails server"
|
|
|
|
status:
|
|
|
|
- "test -f tmp/pids/server.pid"
|
|
|
|
- "pgrep -F tmp/pids/server.pid"
|