From 6ae70e6efa9a96d8565f6da2a96c950e05f413bf Mon Sep 17 00:00:00 2001 From: Bart Reunes Date: Tue, 27 Aug 2024 12:09:52 +0200 Subject: [PATCH 1/4] adding a new compose setup, leveraged by gotask --- .env.dist | 11 ++++++ .gitignore | 4 ++- Dockerfile | 11 ++++++ Taskfile.dist.yml | 64 ++++++++++++++++++++++++++++++++++ compose.dev.yaml | 20 +++++++++++ compose.fixed-ports.mixin.yaml | 5 +++ compose.traefik.mixin.yaml | 15 ++++++++ compose.yaml | 6 ++++ 8 files changed, 135 insertions(+), 1 deletion(-) create mode 100644 .env.dist create mode 100644 Dockerfile create mode 100644 Taskfile.dist.yml create mode 100644 compose.dev.yaml create mode 100644 compose.fixed-ports.mixin.yaml create mode 100644 compose.traefik.mixin.yaml create mode 100644 compose.yaml diff --git a/.env.dist b/.env.dist new file mode 100644 index 0000000..062f581 --- /dev/null +++ b/.env.dist @@ -0,0 +1,11 @@ +PROJECT_DOMAIN_SUFFIX=localhost + +COMPOSE_PROJECT_NAME=yayata +#COMPOSE_FILE=compose.yaml,compose.dev.yaml,compose.traefik.mixin.yaml +COMPOSE_FILE=compose.yaml,compose.dev.yaml,compose.fixed-ports.mixin.yaml +COMPOSE_PATH_SEPARATOR=, + +YAYATA_EXPOSED_PORT=8080 + +API_APPLICATION_BASE_URL=http://ninetofiver.localhost +API_APPLICATION_CLIENT_ID=application-id diff --git a/.gitignore b/.gitignore index d3f6403..19b7d75 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,6 @@ cypress.env.json cypress/videos/ cypress/screenshots/ cypress/.Trash-0/ -.idea/ \ No newline at end of file +.idea/ + +/.env diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..63a7aba --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +FROM node:14-alpine + +RUN mkdir /code +WORKDIR /code +ADD . . + +RUN npm install + +EXPOSE 8080 + +CMD ["npm", "run", "dev", "--", "--host", "0.0.0.0"] diff --git a/Taskfile.dist.yml b/Taskfile.dist.yml new file mode 100644 index 0000000..8163523 --- /dev/null +++ b/Taskfile.dist.yml @@ -0,0 +1,64 @@ +version: '3' + +env: + COMPOSE: docker compose + +dotenv: ['.env'] # first file takes precedence + +tasks: + default: + cmds: + - "'{{.TASK_EXE}}' --list" + + .env: + desc: Initiate the .env file + cmds: + - cp "{{.TASK}}.dist" "{{.TASK}}" + generates: + - "{{.TASK}}" + status: + - test -f "{{.TASK}}" + silent: true + + prepare: + desc: Prepare your setup + deps: [.env] + + build: + desc: Build your services + deps: [prepare] + cmds: + - | + {{.COMPOSE}} build --no-cache + + start: + desc: Start all services + deps: [prepare] + cmds: + - | + {{.COMPOSE}} up --detach --remove-orphans {{.CLI_ARGS}} + + stop: + desc: Stop all services + deps: [prepare] + cmds: + - | + {{.COMPOSE}} down {{.CLI_ARGS}} + + compose:service:*:exec:*: + desc: Open a terminal inside a service + deps: [prepare] + vars: + SERVICE: '{{index .MATCH 0}}' + COMMAND: '{{index .MATCH 1 | default "sh"}}' + cmds: + - | + {{.COMPOSE}} exec --interactive --tty "{{.SERVICE}}" {{.COMMAND}} && exit 0 + + clean: + desc: Clean up + deps: [prepare] + cmds: + - | + {{.COMPOSE}} down --remove-orphans --volumes {{.CLI_ARGS}} + - rm -f .env diff --git a/compose.dev.yaml b/compose.dev.yaml new file mode 100644 index 0000000..78f989f --- /dev/null +++ b/compose.dev.yaml @@ -0,0 +1,20 @@ +services: + + yayata: + command: | + sh -c " + npm install + echo '{\"oauth2\":{\"config\":{\"baseUrl\":\"${API_APPLICATION_BASE_URL?}\",\"clientId\":\"${API_APPLICATION_CLIENT_ID?}\"}}}' > /code/src/static/cfg/config.json + npm run dev -- --host 0.0.0.0 + " + volumes: + - yayata-files:/code + +volumes: + + yayata-files: + driver: local + driver_opts: + o: bind + type: none + device: ${PWD?} diff --git a/compose.fixed-ports.mixin.yaml b/compose.fixed-ports.mixin.yaml new file mode 100644 index 0000000..eea4387 --- /dev/null +++ b/compose.fixed-ports.mixin.yaml @@ -0,0 +1,5 @@ +services: + + yayata: + ports: + - "${YAYATA_EXPOSED_PORT:?}:8080" diff --git a/compose.traefik.mixin.yaml b/compose.traefik.mixin.yaml new file mode 100644 index 0000000..f3dbf31 --- /dev/null +++ b/compose.traefik.mixin.yaml @@ -0,0 +1,15 @@ +services: + + yayata: + networks: + traefik: + labels: + - "traefik.enable=true" + - "traefik.docker.network=traefik" + - "traefik.http.routers.${COMPOSE_PROJECT_NAME?}-yayata.rule=Host(`yayata.${PROJECT_DOMAIN_SUFFIX?}`)" + - "traefik.http.services.${COMPOSE_PROJECT_NAME?}-yayata.loadbalancer.server.port=8080" + +networks: + + traefik: + external: true diff --git a/compose.yaml b/compose.yaml new file mode 100644 index 0000000..aaa70a1 --- /dev/null +++ b/compose.yaml @@ -0,0 +1,6 @@ +services: + + yayata: + build: . + ports: + - "8080" From ff78a098ba089b8948f045f069259535d0041f75 Mon Sep 17 00:00:00 2001 From: Bart Reunes Date: Tue, 27 Aug 2024 13:41:08 +0200 Subject: [PATCH 2/4] name the default network --- compose.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/compose.yaml b/compose.yaml index aaa70a1..d03516c 100644 --- a/compose.yaml +++ b/compose.yaml @@ -2,5 +2,11 @@ services: yayata: build: . + networks: + yayata: ports: - "8080" + +networks: + + yayata: From b1c42fee540bea7c3f1354f947ad677cc13b2501 Mon Sep 17 00:00:00 2001 From: Bart Reunes Date: Tue, 27 Aug 2024 13:51:09 +0200 Subject: [PATCH 3/4] update the readme to use the inuits fork --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 54a2480..a1ef0e9 100644 --- a/README.md +++ b/README.md @@ -5,10 +5,10 @@ YAYATA [![GitHub issues](https://img.shields.io/github/issues/kalmanolah/yayata.svg)](https://shields.io) [![License](https://img.shields.io/github/license/kalmanolah/yayata.svg)](https://shields.io) -![yayata](https://cdn.rawgit.com/kalmanolah/yayata/master/src/assets/img/logo_text.svg) +![yayata](https://cdn.rawgit.com/inuits/yayata/master/src/assets/img/logo_text.svg) Yet Another Timesheet Application... Yet Again. This is a frontend for -[ninetofiver](https://github.com/kalmanolah/925r). +[ninetofiver](https://github.com/inuits/925r). ## Configuration From 7b34c7e9035509505c676e502295295093536572 Mon Sep 17 00:00:00 2001 From: Bart Reunes Date: Mon, 16 Sep 2024 16:45:53 +0200 Subject: [PATCH 4/4] fix typo to be clear that you are NOT logged in --- src/components/AuthLogin.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/AuthLogin.vue b/src/components/AuthLogin.vue index db418bb..c3917d4 100644 --- a/src/components/AuthLogin.vue +++ b/src/components/AuthLogin.vue @@ -53,7 +53,7 @@ export default { }).then(() => { this.$router.push({ name: 'home' }) }, (error) => { - this.errorMessage = error.data.error_description || error.data.error || "Login was now successful. Try again, please." + this.errorMessage = error.data.error_description || error.data.error || "Login was not successful. Try again, please." }) } }