From 21b402d2bb193ff4ae2f1c41aafaa341132efe6f Mon Sep 17 00:00:00 2001 From: Marc Cataford Date: Thu, 9 May 2024 00:27:20 -0400 Subject: [PATCH] feat: minimal func for start+stop+build --- .gitignore | 2 ++ README.md | 5 +++++ Taskfile.yml | 40 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+) create mode 100644 .gitignore create mode 100644 Taskfile.yml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..737ace7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*.env +.services diff --git a/README.md b/README.md index a63a306..d564d17 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,7 @@ # scripts +_Quick and dirty utilities to build, start and stop services._ + +## Usage + +Ensure that `go-task` is installed and `task -l`! diff --git a/Taskfile.yml b/Taskfile.yml new file mode 100644 index 0000000..8bb5f58 --- /dev/null +++ b/Taskfile.yml @@ -0,0 +1,40 @@ +version: '3' + +output: prefixed + +vars: + SERVICES_ROOT: "{{ .ROOT_DIR }}/.services" + CONFIG_ROOT: "/etc/opt/spadinastan" + +tasks: + build: + desc: Builds a service by name. + prefix: "build image: {{ .CLI_ARGS }}" + interactive: true + cmds: + - rm -rf {{.SERVICES_ROOT}}/{{.CLI_ARGS}} + - git clone "git@forge-ssh.karnov.club:spadinastan/{{.CLI_ARGS}}.git" "{{.SERVICES_ROOT}}/{{.CLI_ARGS}}" + - cd {{ .SERVICES_ROOT }}/{{ .CLI_ARGS }} && . ./build.sh + env: + IMAGE_VERSION: "{{.IMAGE_VERSION}}" + + start: + desc: Starts a service by name. + prefix: "start: {{ .CLI_ARGS }}" + cmds: + - rm -rf {{.SERVICES_ROOT}}/{{.CLI_ARGS}} + - git clone "git@forge-ssh.karnov.club:spadinastan/{{.CLI_ARGS}}.git" "{{.SERVICES_ROOT}}/{{.CLI_ARGS}}" + - cd {{ .SERVICES_ROOT }}/{{ .CLI_ARGS }} && . ./start.sh + dotenv: ['common.env'] + env: + IMAGE_VERSION: "{{.IMAGE_VERSION}}" + ENV_FILE_DIR: "{{.CONFIG_ROOT}}" + + stop: + desc: Stops a service by name. + prefix: "stop: {{ .CLI_ARGS }}" + cmds: + - rm -rf {{.SERVICES_ROOT}}/{{.CLI_ARGS}} + - git clone "git@forge-ssh.karnov.club:spadinastan/{{.CLI_ARGS}}.git" "{{.SERVICES_ROOT}}/{{.CLI_ARGS}}" + - cd {{ .SERVICES_ROOT }}/{{ .CLI_ARGS }} && . ./stop.sh + dotenv: ['common.env']