diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000000000000000000000000000000000000..ff86dc46325a6d01bc1b9e6d4feded9c217aab0e --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,89 @@ +stages: + - Build + # - Test + - Docker build + - Deploy + +#services: +# - mongo + +variables: + CONTAINER_IMAGE: 'registry.kszk.bme.hu/bodysch/frontend:$CI_COMMIT_REF_NAME' +# MONGODB_TEST_URI: 'mongodb://mongo/bodysch-test' + +Build: + stage: Build + tags: [kszk] + image: node:14 + script: + - npm install + - npm run build + cache: + paths: + - node_modules/ + - build/ + artifacts: + expire_in: 1 day + paths: + - node_modules/ + - build/ + +#Test: +# stage: Test +# tags: [kszk] +# image: node:14 +# script: +# - npm test +# artifacts: +# expire_in: 1 week +# paths: +# - junit.xml +# reports: +# junit: junit.xml + +Docker build: + stage: Docker build + tags: [kszk] + only: + - master + - dev + image: + name: gcr.io/kaniko-project/executor:debug + entrypoint: [''] + script: + - echo "{\"auths\":{\"registry.kszk.bme.hu\":{\"username\":\"$REGISTRY_USER\",\"password\":\"$REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json + - /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $CONTAINER_IMAGE + +Deploy dev: + stage: Deploy + tags: [kszk-deploy] # request the custom SSH executor + only: + - dev + script: # your deploy logic + - echo "$REGISTRY_PASSWORD" | docker login registry.kszk.bme.hu --username $REGISTRY_USER --password-stdin + - cp docker-compose.dev.yml /home/kszk-gitlab-deployer/bodysch-dev/ + - cd /home/kszk-gitlab-deployer/bodysch-dev/ + - docker-compose -f docker-compose.dev.yml --no-ansi pull + - docker-compose -f docker-compose.dev.yml up -d + - docker system prune -f + variables: + SSH_HOST: donald.sch.bme.hu # required + SSH_USER: kszk-gitlab-deployer # default: kszk-gitlab-deployer + SSH_PORT: 10122 # default: 22 + +# Deploy prod: +# stage: Deploy +# tags: [kszk-deploy] # request the custom SSH executor +# only: +# - master +# script: # your deploy logic +# - echo "$REGISTRY_PASSWORD" | docker login registry.kszk.bme.hu --username $REGISTRY_USER --password-stdin +# - cp docker-compose.yml /home/kszk-gitlab-deployer/kszkepzes-prod/ +# - cd /home/kszk-gitlab-deployer/kszkepzes-prod/ +# - docker-compose --no-ansi pull +# - docker-compose up -d +# - docker system prune -f +# variables: +# SSH_HOST: donald.sch.bme.hu # required +# SSH_USER: kszk-gitlab-deployer # default: kszk-gitlab-deployer +# SSH_PORT: 10122 # default: 22 diff --git a/.prettierignore b/.prettierignore index af62006000ff71589d3375f42ebb5dabb8365f74..9bb1f58d5b979095018e764130581c0e33cc6d3e 100644 --- a/.prettierignore +++ b/.prettierignore @@ -64,4 +64,8 @@ config/* serviceWorker.* setupTests.* -tools/* \ No newline at end of file +tools/* + +.gitlab-ci.yml + +nginx.conf diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000000000000000000000000000000000000..cefc7c4efe67080625d7d9930ac12bb034dc2dae --- /dev/null +++ b/nginx.conf @@ -0,0 +1,61 @@ +# auto detects a good number of processes to run +worker_processes auto; + +#Provides the configuration file context in which the directives that affect connection processing are specified. +events { + # Sets the maximum number of simultaneous connections that can be opened by a worker process. + worker_connections 8000; + # Tells the worker to accept multiple connections at a time + multi_accept on; +} + + +http { + # what times to include + include /etc/nginx/mime.types; + # what is the default one + default_type application/octet-stream; + + # Sets the path, format, and configuration for a buffered log write + log_format compression '$remote_addr - $remote_user [$time_local] ' + '"$request" $status $upstream_addr ' + '"$http_referer" "$http_user_agent"'; + + server { + # listen on port 80 + listen 3040; + # save logs here + access_log /var/log/nginx/access.log compression; + + # where the root here + root /var/www; + # what file to server as index + index index.html index.htm; + + location / { + # First attempt to serve request as file, then + # as directory, then fall back to redirecting to index.html + try_files $uri $uri/ /index.html; + } + + # Media: images, icons, video, audio, HTC + location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ { + expires 1M; + access_log off; + add_header Cache-Control "public"; + } + + # Javascript and CSS files + location ~* \.(?:css|js)$ { + try_files $uri =404; + expires 1y; + access_log off; + add_header Cache-Control "public"; + } + + # Any route containing a file extension (e.g. /devicesfile.js) + location ~ ^.+\..+$ { + try_files $uri =404; + } + } +} diff --git a/tools/local_proxy/Caddyfile b/tools/local_proxy/Caddyfile deleted file mode 100644 index 0a389bc76920c518d7ae24343f3fd2aeeaef395a..0000000000000000000000000000000000000000 --- a/tools/local_proxy/Caddyfile +++ /dev/null @@ -1,13 +0,0 @@ -# PORT -:8080 - -# Reverse proxy -# rewrite - -# auth-service -route /api/* { - #uri strip_prefix /api - reverse_proxy * 127.0.0.1:8000 -} - -reverse_proxy * 127.0.0.1:3000