Improved docker support for deployment #70
This commit is contained in:
parent
ffe7b5e109
commit
f891587ce3
@ -8,7 +8,7 @@ volumes:
|
||||
services:
|
||||
kdb_bot_staging_1:
|
||||
image: kdb-bot/kdb-bot:0.3
|
||||
container_name: kdb_staging_1
|
||||
container_name: kdb_bot_staging_1
|
||||
depends_on:
|
||||
- kdb_db_staging_1
|
||||
volumes:
|
||||
@ -19,7 +19,8 @@ services:
|
||||
KDB_PREFIX: "!kt "
|
||||
restart: 'no'
|
||||
ports:
|
||||
- '8043:80'
|
||||
- '8044:80'
|
||||
command: bash /app/bot/bot -stage
|
||||
|
||||
kdb_web_staging_1:
|
||||
image: kdb-web/kdb-web:0.3
|
||||
@ -30,7 +31,7 @@ services:
|
||||
- kdb_web_staging_1:/app
|
||||
restart: 'no'
|
||||
ports:
|
||||
- '8044:80'
|
||||
- '8043:80'
|
||||
|
||||
kdb_db_staging_1:
|
||||
image: mysql:latest
|
||||
|
@ -13,5 +13,6 @@ RUN apk add bash
|
||||
RUN apk add nano
|
||||
|
||||
RUN pip install -r requirements.txt --extra-index-url https://pip.sh-edraft.de
|
||||
RUN pip install flask[async]
|
||||
|
||||
CMD [ "bash", "/app/bot/bot"]
|
||||
|
@ -51,7 +51,7 @@ class Api(Flask):
|
||||
self.error_handler_spec[None][code][exc_class] = self.handle_exception
|
||||
|
||||
# websockets
|
||||
self._socketio = SocketIO(self, cors_allowed_origins='*')
|
||||
self._socketio = SocketIO(self, cors_allowed_origins='*', path='/api/socket.io')
|
||||
self._socketio.on_event('connect', self.on_connect)
|
||||
self._socketio.on_event('disconnect', self.on_disconnect)
|
||||
|
||||
|
@ -57,6 +57,14 @@
|
||||
],
|
||||
"outputHashing": "all"
|
||||
},
|
||||
"staging": {
|
||||
"fileReplacements": [
|
||||
{
|
||||
"replace": "src/environments/environment.ts",
|
||||
"with": "src/environments/environment.staging.ts"
|
||||
}
|
||||
]
|
||||
},
|
||||
"development": {
|
||||
"buildOptimizer": false,
|
||||
"optimization": false,
|
||||
|
@ -1,2 +1,4 @@
|
||||
FROM nginx:alpine
|
||||
COPY nginx.conf /etc/nginx/nginx.conf
|
||||
RUN rm -rf /usr/share/nginx/html/*
|
||||
COPY ./dist/kdb-web/ /usr/share/nginx/html
|
||||
|
36
kdb-web/nginx.conf
Normal file
36
kdb-web/nginx.conf
Normal file
@ -0,0 +1,36 @@
|
||||
events{}
|
||||
|
||||
http {
|
||||
include /etc/nginx/mime.types;
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
|
||||
sendfile on;
|
||||
default_type application/octet-stream;
|
||||
gzip on;
|
||||
gzip_http_version 1.1;
|
||||
gzip_disable “MSIE [1–6]\.”;
|
||||
gzip_min_length 256;
|
||||
gzip_vary on;
|
||||
gzip_proxied expired no-cache no-store private auth;
|
||||
gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript;
|
||||
gzip_comp_level 9;
|
||||
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html =404;
|
||||
}
|
||||
|
||||
location /api {
|
||||
proxy_pass http://kdb_bot_staging_1;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection 'upgrade';
|
||||
proxy_set_header Host $host;
|
||||
proxy_cache_bypass $http_upgrade;
|
||||
proxy_redirect off;
|
||||
}
|
||||
}
|
||||
}
|
@ -10,7 +10,9 @@
|
||||
"build": "ng build",
|
||||
"watch": "ng build --watch --configuration development",
|
||||
"test": "ng test",
|
||||
"docker-build": "export VERSION=$npm_package_version; ng build; docker build -t kdb-web/kdb-web:$VERSION ."
|
||||
"docker-build": "export VERSION=$npm_package_version; ng build; docker build -t kdb-web/kdb-web:$VERSION .",
|
||||
"docker-build-dev": "export VERSION=$npm_package_version; ng build --configuration development; docker build -t kdb-web/kdb-web:$VERSION .",
|
||||
"docker-build-stage": "export VERSION=$npm_package_version; ng build --configuration staging; docker build -t kdb-web/kdb-web:$VERSION ."
|
||||
},
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
|
@ -1,11 +1,11 @@
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { throwError } from 'rxjs';
|
||||
import { catchError } from 'rxjs/operators';
|
||||
import { Appsettings } from 'src/app/models/config/appsettings';
|
||||
import { SoftwareVersion } from 'src/app/models/config/software-version';
|
||||
import { Theme } from 'src/app/models/view/theme';
|
||||
import { Themes } from 'src/app/models/view/themes.enum';
|
||||
import { HttpClient } from "@angular/common/http";
|
||||
import { Injectable } from "@angular/core";
|
||||
import { throwError } from "rxjs";
|
||||
import { catchError } from "rxjs/operators";
|
||||
import { Appsettings } from "src/app/models/config/appsettings";
|
||||
import { SoftwareVersion } from "src/app/models/config/software-version";
|
||||
import { Theme } from "src/app/models/view/theme";
|
||||
import { environment } from "../../../environments/environment";
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@ -31,11 +31,11 @@ export class SettingsService {
|
||||
}
|
||||
|
||||
public getApiURL(): string {
|
||||
if (!this.appsettings || !this.appsettings.ApiURL) {
|
||||
if (!environment || !environment.apiURL) {
|
||||
console.error('ApiURL is not set!');
|
||||
return '';
|
||||
}
|
||||
return this.appsettings.ApiURL;
|
||||
return environment.apiURL;
|
||||
}
|
||||
|
||||
public getWebVersion(): SoftwareVersion | null {
|
||||
@ -43,12 +43,11 @@ export class SettingsService {
|
||||
console.error('WebVersion is not set!');
|
||||
return null;
|
||||
}
|
||||
const webVersion = new SoftwareVersion(
|
||||
return new SoftwareVersion(
|
||||
this.appsettings.WebVersion.Major,
|
||||
this.appsettings.WebVersion.Minor,
|
||||
this.appsettings.WebVersion.Micro
|
||||
);
|
||||
return webVersion;
|
||||
}
|
||||
|
||||
public getThemes(): Theme[] | null {
|
||||
|
@ -1,11 +1,10 @@
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { ToastOptions } from 'src/app/models/utils/toast-options';
|
||||
import { SettingsService } from '../settings/settings.service';
|
||||
import { SpinnerService } from '../spinner/spinner.service';
|
||||
import { ToastService } from '../toast/toast.service';
|
||||
import { Injectable } from "@angular/core";
|
||||
import { ToastOptions } from "src/app/models/utils/toast-options";
|
||||
import { SettingsService } from "../settings/settings.service";
|
||||
import { SpinnerService } from "../spinner/spinner.service";
|
||||
import { ToastService } from "../toast/toast.service";
|
||||
import io from "socket.io-client";
|
||||
import { MessageService } from 'primeng/api';
|
||||
import { MessageService } from "primeng/api";
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@ -23,7 +22,7 @@ export class SocketService {
|
||||
}
|
||||
|
||||
startSocket() {
|
||||
this.socket = io(`${this.settingsService.getApiURL()}`)
|
||||
this.socket = io(`${this.settingsService.getApiURL()}`, {path: '/api/socket.io'})
|
||||
this.socket.on('connect', () => {
|
||||
if (this.disconnected) {
|
||||
if (this.spinnerService.showSpinnerState) {
|
||||
|
4
kdb-web/src/environments/environment.development.ts
Normal file
4
kdb-web/src/environments/environment.development.ts
Normal file
@ -0,0 +1,4 @@
|
||||
export const environment = {
|
||||
production: true,
|
||||
apiURL: "http://localhost:5000",
|
||||
};
|
@ -1,3 +1,4 @@
|
||||
export const environment = {
|
||||
production: true
|
||||
production: true,
|
||||
apiURL: "https://kdb.keksdose-gaming.de/",
|
||||
};
|
||||
|
4
kdb-web/src/environments/environment.staging.ts
Normal file
4
kdb-web/src/environments/environment.staging.ts
Normal file
@ -0,0 +1,4 @@
|
||||
export const environment = {
|
||||
production: true,
|
||||
apiURL: "https://kdb-test.keksdose-gaming.de/",
|
||||
};
|
@ -3,7 +3,8 @@
|
||||
// The list of file replacements can be found in `angular.json`.
|
||||
|
||||
export const environment = {
|
||||
production: false
|
||||
production: false,
|
||||
apiURL: "https://kdb_web_prod_1",
|
||||
};
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user