Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding a new compose setup, leveraged by gotask #19

Closed
wants to merge 4 commits into from
Closed
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
11 changes: 11 additions & 0 deletions .env.dist
Original file line number Diff line number Diff line change
@@ -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
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@ cypress.env.json
cypress/videos/
cypress/screenshots/
cypress/.Trash-0/
.idea/
.idea/

/.env
11 changes: 11 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
64 changes: 64 additions & 0 deletions Taskfile.dist.yml
Original file line number Diff line number Diff line change
@@ -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
20 changes: 20 additions & 0 deletions compose.dev.yaml
Original file line number Diff line number Diff line change
@@ -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?}
5 changes: 5 additions & 0 deletions compose.fixed-ports.mixin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
services:

yayata:
ports:
- "${YAYATA_EXPOSED_PORT:?}:8080"
15 changes: 15 additions & 0 deletions compose.traefik.mixin.yaml
Original file line number Diff line number Diff line change
@@ -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
12 changes: 12 additions & 0 deletions compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
services:

yayata:
build: .
networks:
yayata:
ports:
- "8080"

networks:

yayata:
2 changes: 1 addition & 1 deletion src/components/AuthLogin.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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."
})
}
}
Expand Down