Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,23 @@
.gitattributes
.github/
.gitignore
.idea/
.sops.yaml
Makefile
README.md
readme.md
docker-compose.yml

codestyle.php
docker-compose*
eslint.config.js
Taskfile.yml
node_modules/
docs/
phpstan*
phpunit.xml.dist
.idea/
public/hot
readme.md
renovate.json5
vendor/
node_modules/
.composer/

environment/dev/
environment/prod/deployment/beta
!/environment/.docker
6 changes: 3 additions & 3 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ APP_URL=https://website.blumilk.local.env

APP_DOCKER_HOST_NAME=website.blumilk.local.env
MAILPIT_DOCKER_HOST_NAME=website-mailpit.blumilk.local.env
VITE_DEV_SERVER_DOCKER_HOST_NAME=website-vite-dev-server.blumilk.local.env
VITE_LOCAL_SERVER_DOCKER_HOST_NAME=website-vite-local-server.blumilk.local.env

MAPBOX_ACCESS_TOKEN=
MAPBOX_STYLE=
Expand All @@ -17,7 +17,7 @@ LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug

DB_CONNECTION=pgsql
DB_HOST=website-db-dev
DB_HOST=website-db-local
DB_PORT=5432
DB_DATABASE=website
DB_USERNAME=website
Expand All @@ -31,7 +31,7 @@ QUEUE_CONNECTION=redis
SESSION_DRIVER=redis
SESSION_LIFETIME=120

REDIS_HOST=website-redis-dev
REDIS_HOST=website-redis-local
REDIS_PASSWORD=null
REDIS_PORT=6379

Expand Down
94 changes: 0 additions & 94 deletions Makefile

This file was deleted.

137 changes: 137 additions & 0 deletions Taskfile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
# https://taskfile.dev
version: "3.42.1"

silent: true

env:
COMPOSE_DOCKER_CLI_BUILD: 1
DOCKER_BUILDKIT: 1
CURRENT_USER_ID:
sh: id --user
DOCKER_COMPOSE_APP_CONTAINER: app
DOCKER_COMPOSE_DATABASE_CONTAINER: database

dotenv:
- .env

includes:
secops: ./environment/secops-Taskfile.yml
devops: ./environment/devops-Taskfile.yml

tasks:
default:
desc: "List all available tasks"
cmds:
- task --list-all

init-project:
desc: "Initialize the project"
aliases: [init]
deps: [run]
cmds:
- cmd: docker compose exec --user $CURRENT_USER_ID $DOCKER_COMPOSE_APP_CONTAINER composer install
- task: _set-app-key
- cmd: docker compose exec --user $CURRENT_USER_ID $DOCKER_COMPOSE_APP_CONTAINER php artisan migrate --seed
- cmd: docker compose exec --user $CURRENT_USER_ID $DOCKER_COMPOSE_APP_CONTAINER php artisan storage:link
- cmd: docker compose exec --user $CURRENT_USER_ID $DOCKER_COMPOSE_APP_CONTAINER npm install
- task: create-test-database

dev:
desc: "Run Vite local dev server"
deps: [run]
cmds:
- cmd: docker compose exec --user $CURRENT_USER_ID $DOCKER_COMPOSE_APP_CONTAINER npm run dev

run-containers:
desc: "Run containers"
aliases: [run]
deps: [build]
preconditions:
- sh: test -f .env
msg: "Please create .env for app."
cmds:
- cmd: docker compose up --detach

stop-containers:
desc: "Stop containers"
aliases: [stop]
cmds:
- cmd: docker compose stop

restart-containers:
desc: "Restart containers"
aliases: [restart]
cmds:
- task: stop-containers
- task: run-containers

build-containers:
desc: "Build containers"
aliases: [build]
cmds:
- cmd: docker compose build --pull

shell-app:
desc: "Enter app shell"
aliases: [shell]
deps: [run]
cmds:
- cmd: docker compose exec --user $CURRENT_USER_ID $DOCKER_COMPOSE_APP_CONTAINER bash

shell-app-root:
desc: "Enter app shell as root"
aliases: [shell-root]
deps: [run]
cmds:
- cmd: docker compose exec --user root $DOCKER_COMPOSE_APP_CONTAINER bash

test:
desc: "Run tests"
deps: [run]
cmds:
- cmd: docker compose exec --user $CURRENT_USER_ID $DOCKER_COMPOSE_APP_CONTAINER composer test

fix:
desc: "Run fixers"
deps: [run]
cmds:
- cmd: docker compose exec --user $CURRENT_USER_ID $DOCKER_COMPOSE_APP_CONTAINER composer fix

analyse:
desc: "Run composer analyse"
deps: [run]
cmds:
- cmd: docker compose exec --user $CURRENT_USER_ID $DOCKER_COMPOSE_APP_CONTAINER composer analyse

type-check:
desc: "Run npm type-check"
deps: [run]
cmds:
- cmd: docker compose exec --user $CURRENT_USER_ID $DOCKER_COMPOSE_APP_CONTAINER npm run type-check

queue:
desc: "Run queue:work"
deps: [run]
cmds:
- cmd: docker compose exec --user $CURRENT_USER_ID $DOCKER_COMPOSE_APP_CONTAINER php artisan queue:work

create-test-database:
desc: "Create test database"
deps: [run]
aliases: [create-test-db]
vars:
TEST_DB_NAME: blumilk-website-test
cmds:
- cmd: docker compose exec $DOCKER_COMPOSE_DATABASE_CONTAINER bash -c "createdb --username=$DB_USERNAME {{ .TEST_DB_NAME }} && echo 'Created database for tests ({{ .TEST_DB_NAME }}).'"
ignore_error: true

_set-app-key:
desc: "Create APP_KEY if not set"
internal: true
cmds:
- |
APP_KEY_VALUE=$(grep APP_KEY .env | cut --delimiter '=' --fields 2-)
if [ -z "${APP_KEY_VALUE}" ]; then
echo "APP_KEY is not set. Creating:"
docker compose exec $DOCKER_COMPOSE_APP_CONTAINER php artisan key:generate
fi
Loading