diff --git a/deploy/.env b/deploy/.env new file mode 100644 index 0000000..1374945 --- /dev/null +++ b/deploy/.env @@ -0,0 +1 @@ +POSHEL=NAHUY \ No newline at end of file diff --git a/deploy/README b/deploy/README new file mode 100644 index 0000000..16ce5bf --- /dev/null +++ b/deploy/README @@ -0,0 +1,6 @@ +пример как заупстить эту помойку на готовом сервер беря исходники с гита + +servers.json можно не класть если есть в гите +GeoLite2-Country.mmdb можно не класть если есть в гите + +nexus.pblr-nyk.pro удалитьь нахуй отовсюда если он есть если ты сам захочешь это говно раскатать \ No newline at end of file diff --git a/deploy/a2s_backend/Dockerfile b/deploy/a2s_backend/Dockerfile new file mode 100644 index 0000000..d3ad6ef --- /dev/null +++ b/deploy/a2s_backend/Dockerfile @@ -0,0 +1,12 @@ +FROM python:3.10 +RUN python -m pip config --user set global.index https://nexus.pblr-nyk.pro/repository/pypi-all/pypi && \ + python -m pip config --user set global.index-url https://nexus.pblr-nyk.pro/repository/pypi-all/simple && \ + python -m pip config --user set global.trusted-host nexus.pblr-nyk.pro +RUN python -m pip install git+https://git.pblr-nyk.pro/mirror/Yepoleb.python-a2s git+https://git.pblr-nyk.pro/mirror/conqp.rcon git+https://git.pblr-nyk.pro/mirror/tiangolo.fastapi "uvicorn[standard]" git+https://git.pblr-nyk.pro/mirror/ValvePython.steam && mkdir /app +ARG BUILDDATE +ENV BUILDDATE $BUILDDATE +RUN cd /tmp && echo $BUILDDATE && git clone https://git.pblr-nyk.pro/gsd/Facti13.Web.Backend.Java.V2 && cd ./Facti13.Web.Backend.Java.V2/ext/python-a2s-rcon-api && cp *.* /app && rm -r /tmp/Facti13.Web.Backend.Java.V2 +WORKDIR /app +ENV PYTHONUNBUFFERED 1 +EXPOSE 8082 +ENTRYPOINT ["python", "service.py"] diff --git a/deploy/docker-compose.yaml b/deploy/docker-compose.yaml new file mode 100644 index 0000000..a1f444e --- /dev/null +++ b/deploy/docker-compose.yaml @@ -0,0 +1,82 @@ +services: + facti13_web_backend_v2: + build: ./java_backend + container_name: backend + restart: always + extra_hosts: + - "tf2.pblr-nyk.pro:192.168.3.1" + - "git.pblr-nyk.pro:192.168.3.1" + volumes: + - $PWD/servers.json:/app/servers.json:ro + - $PWD/GeoLite2-Country.mmdb:/app/geoip.mmdb:ro + - /etc/timezone:/etc/timezone:ro + - /etc/localtime:/etc/localtime:ro + env_file: + - .env + environment: + - A2S_BACKEND_URL=http://a2s_server:8082 + ports: + - 26272:8080 + - 8081:8081 + command: "-Xmx5120m -Xms256m -verbose:gc -XX:+UseZGC -Dio.netty.allocator.useCacheForAllThreads=false -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=8081 -Dcom.sun.management.jmxremote.local.only=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -jar backend.jar" + depends_on: + - facti13_web_backend_v2_a2s_server + logging: + driver: "json-file" + options: + max-size: "5m" + networks: + - facti13_services_net + deploy: + resources: + limits: + cpus: "4.0" + memory: 6144M + facti13_web_backend_v2_a2s_server: + build: ./a2s_backend + container_name: a2s_server + restart: always + extra_hosts: + - "tf2.pblr-nyk.pro:192.168.33.1" + logging: + driver: "json-file" + options: + max-size: "5m" + networks: + - facti13_services_net + deploy: + resources: + limits: + cpus: "0.5" + memory: 512M + facti13_web_backend_v2_docker_client: + build: ./docker_client + container_name: f13_docker_client + restart: always + depends_on: + - facti13_web_backend_v2 + extra_hosts: + - "tf2.pblr-nyk.pro:192.168.3.1" + logging: + driver: "json-file" + options: + max-size: "5m" + networks: + - facti13_services_net + deploy: + resources: + limits: + cpus: "0.5" + memory: 512M + environment: + - ENDPOINT=https://tf2.pblr-nyk.pro + - SECRET_KEY= + - DOCKER_URL=unix:///var/run/docker.sock + volumes: + - /var/run/docker.sock:/var/run/docker.sock:ro + +networks: + facti13_services_net: + external: true + +#docker network create -d bridge --subnet 192.168.0.0/24 facti13_services_net \ No newline at end of file diff --git a/deploy/docker_client/Dockerfile b/deploy/docker_client/Dockerfile new file mode 100644 index 0000000..be6e032 --- /dev/null +++ b/deploy/docker_client/Dockerfile @@ -0,0 +1,12 @@ +FROM python:3.10 +RUN python -m pip config --user set global.index https://nexus.pblr-nyk.pro/repository/pypi-all/pypi && \ + python -m pip config --user set global.index-url https://nexus.pblr-nyk.pro/repository/pypi-all/simple && \ + python -m pip config --user set global.trusted-host nexus.pblr-nyk.pro +RUN python -m pip install aiodocker aiohttp && mkdir /app +ARG BUILDDATE +ENV BUILDDATE $BUILDDATE +RUN cd /tmp && echo $BUILDDATE && git clone https://git.pblr-nyk.pro/gsd/Facti13.Web.Backend.Java.V2 && cd ./Facti13.Web.Backend.Java.V2/ext/python-docker-client && cp *.* /app && rm -r /tmp/Facti13.Web.Backend.Java.V2 +WORKDIR /app +COPY ./ ./ +ENV PYTHONUNBUFFERED 1 +ENTRYPOINT ["python", "dockerclient.py"] diff --git a/deploy/java_backend/Dockerfile b/deploy/java_backend/Dockerfile new file mode 100644 index 0000000..9f3f5ff --- /dev/null +++ b/deploy/java_backend/Dockerfile @@ -0,0 +1,15 @@ +FROM maven:3.8.7-openjdk-18 as builder +WORKDIR /tmp +COPY settings.xml /root/.m2/settings.xml +VOLUME maven_repo /root/.m2/repository +ARG BUILDDATE +ENV BUILDDATE $BUILDDATE +RUN echo $BUILDDATE && git clone https://git.pblr-nyk.pro/gsd/Facti13.Web.Backend.Java.V2 && \ +cd Facti13.Web.Backend.Java.V2 && \ +mvn -f pom.xml clean package -Dmaven.test.skip=true +FROM eclipse-temurin:18 +COPY --from=builder /tmp/Facti13.Web.Backend.Java.V2/target/*.jar /app/backend.jar +WORKDIR /app +ARG BUILDDATE +ENV BUILDDATE $BUILDDATE +ENTRYPOINT ["java"] diff --git a/deploy/java_backend/settings.xml b/deploy/java_backend/settings.xml new file mode 100644 index 0000000..b64762c --- /dev/null +++ b/deploy/java_backend/settings.xml @@ -0,0 +1,37 @@ + + + + + nexus + * + https://nexus.pblr-nyk.pro/repository/maven/ + + + + + nexus + + + + + central + http://central + true + true + + + + + central + http://central + true + true + + + + + + + nexus + + diff --git a/deploy/rebuild.sh b/deploy/rebuild.sh new file mode 100644 index 0000000..a9436bb --- /dev/null +++ b/deploy/rebuild.sh @@ -0,0 +1,2 @@ +#!/bin/bash +docker compose build --build-arg BUILDDATE=$(date +%s) && docker compose down && docker compose up -d && docker compose logs -f