Rename frontend as receiver

This commit is contained in:
nemunaire 2023-07-09 20:40:53 +02:00
parent dc83efa868
commit 1ca5452707
111 changed files with 79 additions and 81 deletions

View File

@ -2,10 +2,10 @@ admin/admin
backend/backend
dashboard/dashboard
evdist/evdist
frontend/frontend
receiver/receiver
repochecker/repochecker
frontend/ui/build
frontend/ui/node_modules
frontend/fic/build
frontend/fic/node_modules
qa/ui/build
qa/ui/node_modules
fickit-backend-initrd.img

View File

@ -1,4 +1,4 @@
image: nemunaire/fic-frontend:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}latest{{/if}}
image: nemunaire/fic-receiver:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}latest{{/if}}
{{#if build.tags}}
tags:
{{#each build.tags}}
@ -6,16 +6,16 @@ tags:
{{/each}}
{{/if}}
manifests:
- image: nemunaire/fic-frontend:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-amd64
- image: nemunaire/fic-receiver:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-amd64
platform:
architecture: amd64
os: linux
- image: nemunaire/fic-frontend:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm64
- image: nemunaire/fic-receiver:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm64
platform:
architecture: arm64
os: linux
variant: v8
- image: nemunaire/fic-frontend:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm
- image: nemunaire/fic-receiver:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm
platform:
architecture: arm
os: linux

View File

@ -19,7 +19,7 @@ steps:
- go get -v -d srs.epita.fr/fic-server/admin
- go get -v -d srs.epita.fr/fic-server/backend
- go get -v -d srs.epita.fr/fic-server/evdist
- go get -v -d srs.epita.fr/fic-server/frontend
- go get -v -d srs.epita.fr/fic-server/receiver
- go get -v -d srs.epita.fr/fic-server/dashboard
- go get -v -d srs.epita.fr/fic-server/repochecker
- go get -v -d srs.epita.fr/fic-server/repochecker/epita
@ -50,7 +50,7 @@ steps:
- go vet -v -buildvcs=false srs.epita.fr/fic-server/admin
- go vet -v -buildvcs=false srs.epita.fr/fic-server/backend
- go vet -v -buildvcs=false srs.epita.fr/fic-server/evdist
- go vet -v -buildvcs=false srs.epita.fr/fic-server/frontend
- go vet -v -buildvcs=false srs.epita.fr/fic-server/receiver
- go vet -v -buildvcs=false srs.epita.fr/fic-server/dashboard
- go vet -v -buildvcs=false srs.epita.fr/fic-server/repochecker
- go vet -v -buildvcs=false srs.epita.fr/fic-server/repochecker/epita
@ -84,21 +84,21 @@ steps:
environment:
CGO_ENABLED: 0
- name: build frontend
- name: build receiver
image: golang:alpine
commands:
- go build -v -buildvcs=false -o deploy/frontend-${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH} srs.epita.fr/fic-server/frontend
- go build -v -buildvcs=false -o deploy/receiver-${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH} srs.epita.fr/fic-server/receiver
environment:
CGO_ENABLED: 0
- name: build frontend ui
- name: build frontend fic ui
image: node:20-alpine
commands:
- cd frontend/ui
- cd frontend/fic
- npm install --network-timeout=100000
- sed -i 's!@popperjs/core/dist/esm/popper!@popperjs/core!' node_modules/sveltestrap/src/*.js node_modules/sveltestrap/src/*.svelte
- npm run build
- tar chjf ../../deploy/htdocs-frontend.tar.bz2 build
- tar chjf ../../deploy/htdocs-frontend-fic.tar.bz2 build
- name: build dashboard
image: golang:alpine
@ -206,17 +206,17 @@ steps:
branch:
- master
- name: docker frontend
- name: docker receiver
image: plugins/docker
settings:
username:
from_secret: docker_username
password:
from_secret: docker_password
repo: nemunaire/fic-frontend
repo: nemunaire/fic-receiver
auto_tag: true
auto_tag_suffix: ${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH}
dockerfile: Dockerfile-frontend
dockerfile: Dockerfile-receiver
when:
branch:
- master
@ -353,7 +353,7 @@ steps:
- go get -v -d srs.epita.fr/fic-server/admin
- go get -v -d srs.epita.fr/fic-server/backend
- go get -v -d srs.epita.fr/fic-server/evdist
- go get -v -d srs.epita.fr/fic-server/frontend
- go get -v -d srs.epita.fr/fic-server/receiver
- go get -v -d srs.epita.fr/fic-server/dashboard
- name: build admin
@ -378,17 +378,17 @@ steps:
environment:
CGO_ENABLED: 0
- name: build frontend
- name: build receiver
image: golang:alpine
commands:
- go build -v -buildvcs=false -o deploy/frontend-${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH} srs.epita.fr/fic-server/frontend
- go build -v -buildvcs=false -o deploy/receiver-${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH} srs.epita.fr/fic-server/receiver
environment:
CGO_ENABLED: 0
- name: build frontend ui
- name: build frontend fic ui
image: node:20-alpine
commands:
- cd frontend/ui
- cd frontend/fic
- npm install --network-timeout=100000
- sed -i 's!@popperjs/core/dist/esm/popper!@popperjs/core!' node_modules/sveltestrap/src/*.js node_modules/sveltestrap/src/*.svelte
- npm run build
@ -502,17 +502,17 @@ steps:
branch:
- master
- name: docker frontend
- name: docker receiver
image: plugins/docker
settings:
username:
from_secret: docker_username
password:
from_secret: docker_password
repo: nemunaire/fic-frontend
repo: nemunaire/fic-receiver
auto_tag: true
auto_tag_suffix: ${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH}
dockerfile: Dockerfile-frontend
dockerfile: Dockerfile-receiver
when:
branch:
- master
@ -620,12 +620,12 @@ steps:
password:
from_secret: docker_password
- name: publish frontend
- name: publish receiver
image: plugins/manifest
settings:
auto_tag: true
ignore_missing: true
spec: .drone-manifest-fic-frontend.yml
spec: .drone-manifest-fic-receiver.yml
username:
from_secret: docker_username
password:

View File

@ -27,6 +27,6 @@ COPY --from=gobuild /go/src/srs.epita.fr/fic-server/dashboard/dashboard /srv/das
COPY dashboard/static/index.html /srv/htdocs-dashboard/
COPY admin/static/css/bootstrap.min.css dashboard/static/css/fic.css admin/static/css/glyphicon.css /srv/htdocs-dashboard/css/
COPY admin/static/fonts /srv/htdocs-dashboard/fonts
COPY frontend/ui/static/img/ dashboard/static/img/srs.png /srv/htdocs-dashboard/img/
COPY frontend/fic/static/img/ dashboard/static/img/srs.png /srv/htdocs-dashboard/img/
COPY dashboard/static/js/dashboard.js admin/static/js/angular.min.js dashboard/static/js/angular-animate.min.js admin/static/js/angular-route.min.js admin/static/js/angular-sanitize.min.js admin/static/js/bootstrap.min.js admin/static/js/common.js admin/static/js/d3.v3.min.js admin/static/js/jquery.min.js /srv/htdocs-dashboard/js/
COPY admin/static/js/i18n/* /srv/htdocs-dashboard/js/i18n/

View File

@ -2,7 +2,7 @@ FROM node:20-alpine as nodebuild
WORKDIR /ui
COPY frontend/ui/ .
COPY frontend/fic/ .
RUN npm install --network-timeout=100000 && \
sed -i 's!@popperjs/core/dist/esm/popper!@popperjs/core!' node_modules/sveltestrap/src/*.js node_modules/sveltestrap/src/*.svelte && \

View File

@ -2,9 +2,7 @@ FROM node:19-alpine3.15 as nodebuild
WORKDIR /ui
RUN apk --no-cache add python2 build-base
COPY frontend/ui/ .
COPY frontend/fic/ .
RUN npm install --network-timeout=100000 && \
sed -i 's!@popperjs/core/dist/esm/popper!@popperjs/core!' node_modules/sveltestrap/src/*.js node_modules/sveltestrap/src/*.svelte && \
@ -14,7 +12,7 @@ RUN npm install --network-timeout=100000 && \
FROM nginx:stable-alpine
ENV FIC_BASEURL=/ \
HOST_FRONTEND=frontend:8080 HOST_ADMIN=admin:8081 HOST_DASHBOARD=dashboard:8082 HOST_QA=qa:8083 \
HOST_RECEIVER=receiver:8080 HOST_ADMIN=admin:8081 HOST_DASHBOARD=dashboard:8082 HOST_QA=qa:8083 \
PATH_FILES=/srv/FILES PATH_STARTINGBLOCK=/srv/STARTINGBLOCK PATH_STATIC=/srv/htdocs-frontend PATH_SETTINGS=/srv/SETTINGSDIST PATH_SYNC=/srv/SYNC PATH_TEAMS=/srv/TEAMS
EXPOSE 80

View File

@ -7,10 +7,10 @@ WORKDIR /go/src/srs.epita.fr/fic-server/
COPY go.mod go.sum ./
COPY settings settings/
COPY libfic ./libfic/
COPY frontend ./frontend/
COPY receiver ./receiver/
RUN go get -d -v ./frontend && \
go build -v -buildvcs=false -o ./frontend/frontend ./frontend
RUN go get -d -v ./receiver && \
go build -v -buildvcs=false -o ./receiver/receiver ./receiver
FROM alpine:3.18
@ -22,6 +22,6 @@ WORKDIR /srv
ENTRYPOINT ["/usr/sbin/entrypoint.sh"]
CMD ["--bind=:8080"]
COPY entrypoint-frontend.sh /usr/sbin/entrypoint.sh
COPY entrypoint-receiver.sh /usr/sbin/entrypoint.sh
COPY --from=gobuild /go/src/srs.epita.fr/fic-server/frontend/frontend /srv/frontend
COPY --from=gobuild /go/src/srs.epita.fr/fic-server/receiver/receiver /srv/receiver

View File

@ -18,13 +18,13 @@ micro-services :
- `evdist` is an inotify reacting service that handles settings
changes during the challenge (eg. a 30 minutes event where hints are
free, ...).
- `frontend` is only responsible for receiving submissions. It is the
- `qa` is an interface dedicated to challenge development, it stores
reports to be treated by challenges creators.
- `receiver` is only responsible for receiving submissions. It is the
only dynamic part accessibe to players, so it's codebase is reduce
to the minimum. It does not parse or try to understand players
submissions, it just write it down to a file in the file
system. Parsing and treatment is made by the `backend`.
- `qa` is an interface dedicated to challenge development, it stores
reports to be treated by challenges creators.
- `remote/challenge-sync-airbus` is an inotify reacting service that
allows us to synchronize scores and exercice validations with the
Airbus scoring platform.

View File

@ -6,8 +6,8 @@
Version de l'API : {{ v.version }}
</p>
<p ng-controller="TimestampController">
Latence frontend-backend : <span ng-class="{'text-success': t.diffFB <= 1000000000, 'text-warning': t.diffFB > 1000000000, 'text-danger': t.diffFB > 1500000000}"><ng-pluralize count="t.diffFB / 1000000000" when="{'one': '{}&nbsp;seconde', 'other': '{}&nbsp;secondes'}"></ng-pluralize></span><br>
Dernière synchronisation du frontend : {{ t.frontend | date:"mediumTime" }}
Latence frontal : <span ng-class="{'text-success': t.diffFB <= 1000000000, 'text-warning': t.diffFB > 1000000000, 'text-danger': t.diffFB > 1500000000}"><ng-pluralize count="t.diffFB / 1000000000" when="{'one': '{}&nbsp;seconde', 'other': '{}&nbsp;secondes'}"></ng-pluralize></span><br>
Dernière synchronisation du frontal : {{ t.frontend | date:"mediumTime" }}
</p>
<ul class="pagination" ng-controller="SubmissionsStatsController">
<li class="page-item" title="Nombre de soumissions la dernière minute"><a class="page-link">{{ submissionsstats.nbsubminute }}</a></li>

View File

@ -189,7 +189,7 @@ server {
location /submit/ {
include fic-auth.conf;
proxy_pass http://frontend:8080/submission;
proxy_pass http://receiver:8080/submission;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-FIC-Team $team;
proxy_redirect off;
@ -197,7 +197,7 @@ server {
location /issue {
include fic-auth.conf;
proxy_pass http://frontend:8080;
proxy_pass http://receiver:8080;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-FIC-Team $team;
proxy_redirect off;
@ -205,7 +205,7 @@ server {
location /chname {
include fic-auth.conf;
proxy_pass http://frontend:8080;
proxy_pass http://receiver:8080;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-FIC-Team $team;
proxy_redirect off;
@ -213,7 +213,7 @@ server {
location /registration {
include fic-auth.conf;
proxy_pass http://frontend:8080;
proxy_pass http://receiver:8080;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-FIC-Team $team;
proxy_redirect off;
@ -221,7 +221,7 @@ server {
location /openhint/ {
include fic-auth.conf;
proxy_pass http://frontend:8080;
proxy_pass http://receiver:8080;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-FIC-Team $team;
proxy_redirect off;
@ -229,7 +229,7 @@ server {
location /wantchoices/ {
include fic-auth.conf;
proxy_pass http://frontend:8080;
proxy_pass http://receiver:8080;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-FIC-Team $team;
proxy_redirect off;

View File

@ -170,7 +170,7 @@ server {
location /submit/ {
include fic-get-team.conf;
proxy_pass http://${HOST_FRONTEND}/submission/;
proxy_pass http://${HOST_RECEIVER}/submission/;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-FIC-Team $team;
proxy_redirect off;
@ -178,7 +178,7 @@ server {
location /issue {
include fic-get-team.conf;
proxy_pass http://${HOST_FRONTEND};
proxy_pass http://${HOST_RECEIVER};
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-FIC-Team $team;
proxy_redirect off;
@ -186,7 +186,7 @@ server {
location /chname {
include fic-get-team.conf;
proxy_pass http://${HOST_FRONTEND};
proxy_pass http://${HOST_RECEIVER};
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-FIC-Team $team;
proxy_redirect off;
@ -194,7 +194,7 @@ server {
location /registration {
include fic-get-team.conf;
proxy_pass http://${HOST_FRONTEND};
proxy_pass http://${HOST_RECEIVER};
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-FIC-Team $team;
proxy_redirect off;
@ -202,7 +202,7 @@ server {
location /openhint/ {
include fic-get-team.conf;
proxy_pass http://${HOST_FRONTEND};
proxy_pass http://${HOST_RECEIVER};
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-FIC-Team $team;
proxy_redirect off;
@ -210,7 +210,7 @@ server {
location /wantchoices/ {
include fic-get-team.conf;
proxy_pass http://${HOST_FRONTEND};
proxy_pass http://${HOST_RECEIVER};
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-FIC-Team $team;
proxy_redirect off;

View File

@ -179,7 +179,7 @@ server {
location /submit/ {
include fic-get-team.conf;
proxy_pass http://frontend:8080/submission/;
proxy_pass http://receiver:8080/submission/;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-FIC-Team $team;
proxy_redirect off;
@ -187,7 +187,7 @@ server {
location /issue {
include fic-get-team.conf;
proxy_pass http://frontend:8080;
proxy_pass http://receiver:8080;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-FIC-Team $team;
proxy_redirect off;
@ -195,7 +195,7 @@ server {
location /chname {
include fic-get-team.conf;
proxy_pass http://frontend:8080;
proxy_pass http://receiver:8080;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-FIC-Team $team;
proxy_redirect off;
@ -203,7 +203,7 @@ server {
location /registration {
include fic-get-team.conf;
proxy_pass http://frontend:8080;
proxy_pass http://receiver:8080;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-FIC-Team $team;
proxy_redirect off;
@ -211,7 +211,7 @@ server {
location /openhint/ {
include fic-get-team.conf;
proxy_pass http://frontend:8080;
proxy_pass http://receiver:8080;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-FIC-Team $team;
proxy_redirect off;
@ -219,7 +219,7 @@ server {
location /wantchoices/ {
include fic-get-team.conf;
proxy_pass http://frontend:8080;
proxy_pass http://receiver:8080;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-FIC-Team $team;
proxy_redirect off;

View File

@ -89,11 +89,11 @@ services:
environment:
- MYSQL_HOST=mysql
frontend:
receiver:
build:
context: .
dockerfile: Dockerfile-frontend
image: nemunaire/fic-frontend:latest
dockerfile: Dockerfile-receiver
image: nemunaire/fic-receiver:latest
command: "-startedFile /srv/startingblock/started -bind :8080"
ports:
- "8080:8080"
@ -144,7 +144,7 @@ services:
- startingblock:/srv/STARTINGBLOCK:ro
depends_on:
- qa
- frontend
- receiver
- dashboard
- backend
- admin

View File

@ -30,4 +30,4 @@ run() {
echo "${BASEURL}" > /chbase-done
}
exec /srv/frontend $@
exec /srv/receiver $@

View File

@ -68,17 +68,17 @@ onboot:
# - name: eth4
# - name: bond-frontal
# add: bond
- name: frontend-ip-setup
- name: receiver-ip-setup
image: linuxkit/ip:c88e3272e3b12edec454e4720da8bb70a7655bc7
command: ["/bin/sh", "-c", "ip a add 172.17.1.3/24 dev vethin-frontend; ip link set vethin-frontend up;" ]
command: ["/bin/sh", "-c", "ip a add 172.17.1.3/24 dev vethin-receiver; ip link set vethin-receiver up;" ]
net: new
runtime:
interfaces:
- name: vethin-frontend
- name: vethin-receiver
add: veth
peer: veth-frontend
peer: veth-receiver
bindNS:
net: /run/netns/fic-frontend
net: /run/netns/fic-receiver
- name: sshd-ip-setup
image: linuxkit/ip:c88e3272e3b12edec454e4720da8bb70a7655bc7
command: ["/bin/sh", "-c", "ip a add 10.10.10.2/29 dev eth2; ip link set eth2 up;" ]
@ -101,7 +101,7 @@ onboot:
net: /run/netns/auth
- name: bridge-setup
image: linuxkit/ip:c88e3272e3b12edec454e4720da8bb70a7655bc7
command: ["/bin/sh", "-c", "ip a add 172.17.1.1/24 dev br0; ip link set veth-nginx master br0; ip link set veth-frontend master br0; ip link set veth-auth master br0; ip link set br0 up; ip link set veth-nginx up; ip link set veth-frontend up; ip link set veth-auth up;" ]
command: ["/bin/sh", "-c", "ip a add 172.17.1.1/24 dev br0; ip link set veth-nginx master br0; ip link set veth-receiver master br0; ip link set veth-auth master br0; ip link set br0 up; ip link set veth-nginx up; ip link set veth-receiver up; ip link set veth-auth up;" ]
runtime:
interfaces:
- name: br0
@ -172,9 +172,9 @@ services:
- /var/lib/fic/startingblock
- /var/lib/fic/settingsdist
- /var/lib/fic/teams
- name: fic-frontend
image: nemunaire/fic-frontend:latest@sha256:6bbecfaedd551fa6e6e13f741d7fa71291e495f3959dfd36d20b226007063f39
command: ["/srv/frontend", "-bind=:8080", "-startedFile=/srv/startingblock/started"]
- name: fic-receiver
image: nemunaire/fic-receiver:latest@sha256:6bbecfaedd551fa6e6e13f741d7fa71291e495f3959dfd36d20b226007063f39
command: ["/srv/receiver", "-bind=:8080", "-startedFile=/srv/startingblock/started"]
binds:
- /etc/hosts:/etc/hosts:ro
- /var/lib/fic/files:/srv/FILES:ro
@ -182,7 +182,7 @@ services:
- /var/lib/fic/startingblock:/srv/startingblock
- /var/lib/fic/submissions:/srv/submissions
- /var/lib/fic/teams:/srv/TEAMS:ro
net: /run/netns/fic-frontend
net: /run/netns/fic-receiver
runtime:
mkdir:
- /var/lib/fic/files

View File

@ -70,12 +70,12 @@
installPhase = "mkdir -p $out/; cp -r configs/ $out/";
};
fic-frontend = pkgs.buildGoModule {
pname = "frontend";
fic-receiver = pkgs.buildGoModule {
pname = "receiver";
inherit version vendorSha256 overrideModAttrs;
src = ./.;
subPackages = [ "frontend" ];
subPackages = [ "receiver" ];
};
fic-qa = pkgs.buildGoModule {

1
frontend/.gitignore vendored
View File

@ -1 +0,0 @@
frontend

View File

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

1
receiver/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
receiver

Some files were not shown because too many files have changed in this diff Show More