Compare commits
5 commits
cad579e759
...
d45d1ad56f
Author | SHA1 | Date | |
---|---|---|---|
|
d45d1ad56f | ||
|
3335c68e80 | ||
|
41f19acd8c | ||
|
a42122213b | ||
|
e24b0f3660 |
9 changed files with 115 additions and 26 deletions
2
.dockerignore
Normal file
2
.dockerignore
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
.git
|
||||||
|
.dockerignore
|
1
.env.production
Normal file
1
.env.production
Normal file
|
@ -0,0 +1 @@
|
||||||
|
VITE_API_URL=https://psp.dets.ch/api
|
53
.gitlab-ci.yml
Normal file
53
.gitlab-ci.yml
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
stages:
|
||||||
|
- build
|
||||||
|
- deploy
|
||||||
|
|
||||||
|
variables:
|
||||||
|
PY_COLORS: '1'
|
||||||
|
ANSIBLE_FORCE_COLOR: '1'
|
||||||
|
ANSIBLE_PYTHON_INTERPRETER: auto_silent
|
||||||
|
ANSIBLE_STDOUT_CALLBACK: debug
|
||||||
|
|
||||||
|
docker-build-master:
|
||||||
|
# Official docker image.
|
||||||
|
image: docker:latest
|
||||||
|
stage: build
|
||||||
|
tags:
|
||||||
|
- docker
|
||||||
|
services:
|
||||||
|
- docker:dind
|
||||||
|
before_script:
|
||||||
|
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
|
||||||
|
script:
|
||||||
|
- docker build --pull -t "$CI_REGISTRY_IMAGE" .
|
||||||
|
- docker push "$CI_REGISTRY_IMAGE"
|
||||||
|
only:
|
||||||
|
- master
|
||||||
|
|
||||||
|
docker-build:
|
||||||
|
# Official docker image.
|
||||||
|
image: docker:latest
|
||||||
|
stage: build
|
||||||
|
tags:
|
||||||
|
- docker
|
||||||
|
services:
|
||||||
|
- docker:dind
|
||||||
|
before_script:
|
||||||
|
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
|
||||||
|
script:
|
||||||
|
- docker build --pull -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" .
|
||||||
|
- docker push "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG"
|
||||||
|
except:
|
||||||
|
- main
|
||||||
|
|
||||||
|
deploy-master:
|
||||||
|
#when: manual
|
||||||
|
stage: deploy
|
||||||
|
image:
|
||||||
|
name: cytopia/ansible:latest-tools
|
||||||
|
entrypoint: [""]
|
||||||
|
script:
|
||||||
|
- chmod 600 "${ANSIBLE_SSH_KEY_PRIVATE}"
|
||||||
|
- ansible-playbook -i ./deployment/hosts.yml --private-key "${ANSIBLE_SSH_KEY_PRIVATE}" "./deployment/deployment.yml"
|
||||||
|
only:
|
||||||
|
- main
|
12
Dockerfile
Normal file
12
Dockerfile
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
FROM node:alpine as build-stage
|
||||||
|
WORKDIR /app
|
||||||
|
COPY package*.json ./
|
||||||
|
RUN npm install
|
||||||
|
COPY . .
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
# production stage
|
||||||
|
FROM nginx:stable-alpine as production-stage
|
||||||
|
COPY --from=build-stage /app/dist /usr/share/nginx/html
|
||||||
|
EXPOSE 80
|
||||||
|
CMD ["nginx", "-g", "daemon off;"]
|
27
README.md
27
README.md
|
@ -1,27 +1,4 @@
|
||||||
# Vue 3 + Typescript + Vite
|
# Radiator-Web
|
||||||
|
|
||||||
This template should help get you started developing with Vue 3 and Typescript in Vite.
|
API URL must be set on Build Time, either via Env `API_URL`(prefered), or via `VITE_API_URL` from [`.env.production`](.env.production)
|
||||||
|
|
||||||
## Recommended IDE Setup
|
|
||||||
|
|
||||||
[VSCode](https://code.visualstudio.com/) + [Vetur](https://marketplace.visualstudio.com/items?itemName=octref.vetur). Make sure to enable `vetur.experimental.templateInterpolationService` in settings!
|
|
||||||
|
|
||||||
### If Using `<script setup>`
|
|
||||||
|
|
||||||
[`<script setup>`](https://github.com/vuejs/rfcs/pull/227) is a feature that is currently in RFC stage. To get proper IDE support for the syntax, use [Volar](https://marketplace.visualstudio.com/items?itemName=johnsoncodehk.volar) instead of Vetur (and disable Vetur).
|
|
||||||
|
|
||||||
## Type Support For `.vue` Imports in TS
|
|
||||||
|
|
||||||
Since TypeScript cannot handle type information for `.vue` imports, they are shimmed to be a generic Vue component type by default. In most cases this is fine if you don't really care about component prop types outside of templates. However, if you wish to get actual prop types in `.vue` imports (for example to get props validation when using manual `h(...)` calls), you can use the following:
|
|
||||||
|
|
||||||
### If Using Volar
|
|
||||||
|
|
||||||
Run `Volar: Switch TS Plugin on/off` from VSCode command palette.
|
|
||||||
|
|
||||||
### If Using Vetur
|
|
||||||
|
|
||||||
1. Install and add `@vuedx/typescript-plugin-vue` to the [plugins section](https://www.typescriptlang.org/tsconfig#plugins) in `tsconfig.json`
|
|
||||||
2. Delete `src/shims-vue.d.ts` as it is no longer needed to provide module info to Typescript
|
|
||||||
3. Open `src/main.ts` in VSCode
|
|
||||||
4. Open the VSCode command palette
|
|
||||||
5. Search and run "Select TypeScript version" -> "Use workspace version"
|
|
||||||
|
|
22
deployment/deployment.yml
Normal file
22
deployment/deployment.yml
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
---
|
||||||
|
- hosts: snickers-docker
|
||||||
|
gather_facts: no
|
||||||
|
vars:
|
||||||
|
verbose: false
|
||||||
|
compose_folder: "/mnt/docker-storage/radiator-web/"
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
- name: Ensures {{ compose_folder }} dir exists
|
||||||
|
stat:
|
||||||
|
path: "{{ compose_folder }}docker-compose.yml"
|
||||||
|
register: file_details
|
||||||
|
|
||||||
|
- name: Fail if docker-compose file doesn't exist
|
||||||
|
fail:
|
||||||
|
msg: "docker-compose.yml doesn't exist in expected location (expected in {{ compose_folder }})"
|
||||||
|
when: not file_details.stat.exists
|
||||||
|
|
||||||
|
- name: Update container image
|
||||||
|
community.general.docker_compose:
|
||||||
|
project_src: "{{ compose_folder }}"
|
||||||
|
pull: yes
|
10
deployment/hosts.yml
Normal file
10
deployment/hosts.yml
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
all:
|
||||||
|
vars:
|
||||||
|
ansible_python_interpreter: /usr/bin/python3
|
||||||
|
hosts:
|
||||||
|
snickers-docker:
|
||||||
|
ansible_host: 192.168.200.11
|
||||||
|
ansible_port: 22
|
||||||
|
ansible_user: root
|
||||||
|
ansible_ssh_extra_args: '-o StrictHostKeyChecking=no'
|
||||||
|
ansible_ssh_common_args: '-o ProxyCommand="ssh -o StrictHostKeyChecking=no -i "${ANSIBLE_SSH_KEY_PRIVATE}" -W %h:%p root@vserver8.alex-detsch.de -p 52"'
|
12
docker-compose.yml
Normal file
12
docker-compose.yml
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
web:
|
||||||
|
image: registry.alex-detsch.de/fem/radiator/radiator-web
|
||||||
|
restart: always
|
||||||
|
healthcheck:
|
||||||
|
test: "curl localhost"
|
||||||
|
interval: "60s"
|
||||||
|
timeout: "3s"
|
||||||
|
start_period: "5s"
|
||||||
|
retries: 3
|
||||||
|
stop_grace_period: 3s
|
||||||
|
ports:
|
||||||
|
- "1499:80"
|
|
@ -16,7 +16,7 @@ const enum HTTPMethod {
|
||||||
PATCH = "PATCH",
|
PATCH = "PATCH",
|
||||||
}
|
}
|
||||||
|
|
||||||
const url = "http://192.168.178.5:8080/api";
|
const url = import.meta.env.API_URL ?? import.meta.env.VITE_API_URL;
|
||||||
let token: token;
|
let token: token;
|
||||||
let ready = false;
|
let ready = false;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue