diff --git a/apps/safeline/.env b/apps/safeline/.env index 0eb6effaa..3a5baf63e 100644 --- a/apps/safeline/.env +++ b/apps/safeline/.env @@ -1,34 +1,26 @@ -W9_REPO="wordpress" +W9_REPO="chaitin/safeline" W9_DIST=community W9_VERSION="latest" W9_POWER_PASSWORD="1PrMxExC45LsCT" +W9_RCODE='V3G8Jqzk15kHy' + # Environments which for user settings when create application # Named expression: W9_xxx_xxx_SET, xxx refer to file fields W9_HTTP_PORT_SET=9001 -# W9_HTTPS_PORT_SET=9002 -# W9_DB_PORT_SET=3306 -# W9_SSH_PORT_SET=23 -W9_KEY_SET="dfsjdkjf77xjxcjcj" #### -- Not allowed to edit below environments when recreate app based on existing data -- #### -W9_ID=safeline - -# W9_HTTP_PORT or W9_HTTPS_PORT is need at leaset and used for proxy for web application -# Some container (e.g teleport) need HTTPS access, then need to set this pra -W9_HTTP_PORT=80 -W9_HTTPS_PORT=81 +W9_ID=safeline_sgtuf W9_LOGIN_USER=admin # use https://1password.com/zh-cn/password-generator/ to genarate 14 bit password # this password can also use password file W9_LOGIN_PASSWORD=$W9_POWER_PASSWORD -W9_ADMIN_PATH="/wp-login" # Container name's suffix must use one of the value -W9_DB_EXPOSE="mysql,postgresql,mariadb,mongodb,redis" +W9_DB_EXPOSE="postgres" # It is used when the application APP needs to set an external URL, which can be IP(or domain), IP:PORT # If have protocols, should be set it in the APP's ENV @@ -38,16 +30,6 @@ W9_URL_REPLACE=true W9_NETWORK=websoft9 -#### ----------------------------------------------------------------------------------------- #### - - -# Below environment is created by this app - -WORDPRESS_DB_HOST=$W9_ID-mariadb -WORDPRESS_DB_USER=wordpress #if use postgresql, it need set to postgres -WORDPRESS_DB_PASSWORD=$W9_POWER_PASSWORD -WORDPRESS_DB_NAME=wordpress - +POSTGRES_PASSWORD=$W9_POWER_PASSWORD #-------(自定义密码使用数字+英文大小写组合,勿使用特殊字符) -#W9_NAME="" -#W9_RCODE="" \ No newline at end of file +MGT_PROXY=0 \ No newline at end of file diff --git a/apps/safeline/docker-compose.yml b/apps/safeline/docker-compose.yml index 1c1948688..f0088c7ba 100644 --- a/apps/safeline/docker-compose.yml +++ b/apps/safeline/docker-compose.yml @@ -1,50 +1,146 @@ -# image,docs: https://hub.docker.com/_/wordpress/ +# image: https://hub.docker.com/u/chaitin +# docs: https://help.waf-ce.chaitin.cn/node/01973fc6-e12f-789f-a8ff-e81d383c80bc services: - - wordpress: - image: $W9_REPO:$W9_VERSION - container_name: $W9_ID - restart: unless-stopped - #This is for access host from container - # extra_hosts: ["host.docker.internal:host-gateway"] - # command: | - # /bin/bash -c "ping -c 3 host.docker.internal" + postgres: + container_name: ${W9_ID}-pg + restart: always + image: ${W9_REPO}-postgres:15.2 + volumes: + - data:/var/lib/postgresql/data + - /etc/localtime:/etc/localtime:ro + environment: + - POSTGRES_USER=safeline-ce + - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:?postgres password required} + command: [postgres, -c, max_connections=600] + healthcheck: + test: pg_isready -U safeline-ce -d safeline-ce + mgt: + container_name: ${W9_ID} + restart: always + image: ${W9_REPO}-mgt:${W9_VERSION} + volumes: + - /etc/localtime:/etc/localtime:ro + - mgt:/app/data + - nginx-logs:/app/log/nginx:z + - sock:/app/sock + - /var/run:/app/run + ports: + - ${W9_HTTP_PORT_SET}:1443 + healthcheck: + test: curl -k -f https://localhost:1443/api/open/health + env_file: .env + environment: + - MGT_PG=postgres://safeline-ce:${POSTGRES_PASSWORD}@${W9_ID}-pg/safeline-ce?sslmode=disable + - MGT_PROXY=${MGT_PROXY} + - LUIGI_HOST=${W9_RCODE}-luigi + - FVM_HOST=${W9_RCODE}-fvm + - DETECTOR_HOST=${W9_RCODE}-detector + - CHAOS_SERVE_ADDR=http://safeline-chaos:9000 + - CHAOS_CHALLENGE_ADDR=http://safeline-chaos:8080 + depends_on: + - postgres + - fvm logging: driver: "json-file" options: - max-file: "5" - max-size: 10m - deploy: - resources: - limits: - memory: 5g - cpus: '0.7' - ports: - - $W9_HTTP_PORT_SET:80 - env_file: .env + max-size: "100m" + max-file: "5" + detect: + container_name: ${W9_ID}-detector + hostname: ${W9_RCODE}-detector + restart: always + image: ${W9_REPO}-detector:${W9_VERSION} volumes: - - wordpress:/var/www/html - - ./src/php_exra.ini:/usr/local/etc/php/conf.d/php_exra.ini - - mariadb: - image: mariadb:10.4 - container_name: $W9_ID-mariadb - restart: unless-stopped - command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci --innodb_log_buffer_size=30M + - detector:/resources/detector + - detector-logs:/logs/detector + - /etc/localtime:/etc/localtime:ro + environment: + - LOG_DIR=/logs/detector + - MGT_HOST=${W9_ID}-mgt + tengine: + container_name: ${W9_ID}-tengine + restart: always + image: ${W9_REPO}-tengine:${W9_VERSION} + volumes: + - /etc/localtime:/etc/localtime:ro + - /etc/resolv.conf:/etc/resolv.conf:ro + - nginx:/etc/nginx + - detector:/resources/detector + - chaos:/resources/chaos + - nginx-logs:/var/log/nginx:z + - cache:/usr/local/nginx/cache + - sock:/app/sock + environment: + - TCD_MGT_API=https://${W9_ID}-mgt:1443/api/open/publish/server + - CHALLENGE_SERVER=safeline-chaos:8080 + ulimits: + nofile: 131072 + network_mode: host + luigi: + container_name: ${W9_ID}-luigi + hostname: ${W9_RCODE}-luigi + restart: always + image: ${W9_REPO}-luigi:${W9_VERSION} + environment: + - MGT_IP=${W9_ID}-mgt + - DETECTOR_HOST=${W9_ID}-detector + - LUIGI_PG=postgres://safeline-ce:${POSTGRES_PASSWORD}@${W9_ID}-pg/safeline-ce?sslmode=disable volumes: - - mysql_data:/var/lib/mysql + - /etc/localtime:/etc/localtime:ro + - luigi:/app/data + logging: + driver: "json-file" + options: + max-size: "100m" + max-file: "5" + depends_on: + - detect + - mgt + fvm: + container_name: ${W9_ID}-fvm + hostname: ${W9_RCODE}-fvm + restart: always + image: ${W9_REPO}-fvm:${W9_VERSION} + environment: + - MGT_HOST=${W9_ID}-mgt + - DETECTOR_HOST=${W9_ID}-detector + volumes: + - /etc/localtime:/etc/localtime:ro + logging: + driver: "json-file" + options: + max-size: "100m" + max-file: "5" + chaos: + container_name: safeline-chaos + restart: always + image: ${W9_REPO}-chaos:${W9_VERSION} + logging: + driver: "json-file" + options: + max-size: "100m" + max-file: "10" environment: - MYSQL_DATABASE: $WORDPRESS_DB_NAME - MYSQL_USER: $WORDPRESS_DB_USER - MYSQL_PASSWORD: $W9_POWER_PASSWORD - MYSQL_ROOT_PASSWORD: $W9_POWER_PASSWORD + - DB_ADDR=postgres://safeline-ce:${POSTGRES_PASSWORD}@${W9_ID}-pg/safeline-ce?sslmode=disable + volumes: + - sock:/app/sock + - chaos:/app/chaos volumes: - wordpress: - mysql_data: - + data: + mgt: + sock: + detector: + luigi: + nginx: + chaos: + cache: + nginx-logs: + detector-logs: + + networks: default: - name: $W9_NETWORK external: true + name: $W9_NETWORK \ No newline at end of file diff --git a/apps/safeline/variables.json b/apps/safeline/variables.json index 3db8914ef..c49e87908 100644 --- a/apps/safeline/variables.json +++ b/apps/safeline/variables.json @@ -8,7 +8,8 @@ { "dist": "community", "version": [ - "9.3.2" + "9.3.2", + "latest" ] } ],