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

vue3 rewrite #128

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
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
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ services:

frontend:
build:
context: frontend
context: frontend_new
args:
SERVER_HTTP: http://localhost:8080/query
SERVER_WS: ws://localhost:8081/query
Expand Down
28 changes: 28 additions & 0 deletions frontend_new/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
.DS_Store
dist
dist-ssr
coverage
*.local

/cypress/videos/
/cypress/screenshots/

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
3 changes: 3 additions & 0 deletions frontend_new/.vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"recommendations": ["Vue.volar", "Vue.vscode-typescript-vue-plugin"]
}
25 changes: 25 additions & 0 deletions frontend_new/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# build stage
FROM node:lts-alpine as altklausur_ausleihe-frontend-build-stage
WORKDIR /app
COPY package*.json *.config.js index.html ./
RUN npm install
COPY ./src ./src
COPY ./public ./public

ARG SERVER_WS
ENV SERVER_WS "$SERVER_WS"
ARG SERVER_HTTP
ENV SERVER_HTTP "$SERVER_HTTP"
ENV NODE_OPTIONS "--openssl-legacy-provider"

RUN sed -i "s,SERVER\_WS,\"$SERVER_WS\",g" ./src/vue-apollo.js
RUN sed -i "s,SERVER\_HTTP,\"$SERVER_HTTP\",g" ./src/vue-apollo.js
RUN npm run build

# production stage
FROM nginx:stable-alpine as altklausur_ausleihe-frontend-production-stage
ARG NGINX_CONFIG_NAME
COPY --from=altklausur_ausleihe-frontend-build-stage /app/dist /usr/share/nginx/html
COPY $NGINX_CONFIG_NAME /etc/nginx/conf.d/default.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
29 changes: 29 additions & 0 deletions frontend_new/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# altklausuren-ausleihe

This template should help get you started developing with Vue 3 in Vite.

## Recommended IDE Setup

[VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur) + [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin).

## Customize configuration

See [Vite Configuration Reference](https://vitejs.dev/config/).

## Project Setup

```sh
npm install
```

### Compile and Hot-Reload for Development

```sh
npm run dev
```

### Compile and Minify for Production

```sh
npm run build
```
18 changes: 18 additions & 0 deletions frontend_new/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="icon" href="/favicon.png">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Altklausurenausleihe - Fachschaft MathPhysInfo</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@mdi/font@latest/css/materialdesignicons.min.css">
</head>
<body>
<noscript>
<strong>We're sorry but Altklausuren Ausleihe doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<script type="module" src="/src/main.js"></script>
</body>
</html>
42 changes: 42 additions & 0 deletions frontend_new/nginx-prod.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
upstream backend-upstream {
server backend:8081;
}

upstream exam_marker-upstream {
server exam_marker:8081;
}

server {
listen 80;
listen [::]:80;

server_name localhost;
client_max_body_size 15M;

location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}

location /query {
proxy_pass http://backend-upstream/query;
}

location /adminlogin {
proxy_pass http://backend-upstream/adminlogin;
}

location /backend/metrics {
proxy_pass http://backend-upstream/metrics;
}

location /exam_marker/metrics {
proxy_pass http://exam_marker-upstream/metrics;
}

error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
54 changes: 54 additions & 0 deletions frontend_new/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
upstream backend-upstream {
server backend:8081;
}

upstream exam_marker-upstream {
server exam_marker:8081;
}

server {
listen 80;
listen [::]:80;

server_name localhost;
client_max_body_size 15M;

location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}

location /query {
proxy_pass http://backend-upstream/query;
}

location /testlogin {
proxy_pass http://backend-upstream/testlogin;
}

location /distributor/lti_launch {
proxy_pass http://backend-upstream/distributor/lti_launch;
}

location /distributor/lti_config {
proxy_pass http://backend-upstream/distributor/lti_config;
}

location /adminlogin {
proxy_pass http://backend-upstream/adminlogin;
}

location /backend/metrics {
proxy_pass http://backend-upstream/metrics;
}

location /exam_marker/metrics {
proxy_pass http://exam_marker-upstream/metrics;
}

error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
Loading