diff --git a/Dockerfile b/Dockerfile index 6a8018b3a..d9047ec98 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,6 +2,11 @@ FROM orvice/apache-base MAINTAINER orvice ENV SSPANEL_VERSION 4.0.0 + +RUN apt-get update && apt-get install -y \ + netcat \ + && rm -rf /var/lib/apt/lists/* + WORKDIR /var/www/html # Install sspanel diff --git a/app/Controllers/MuV2/NodeController.php b/app/Controllers/MuV2/NodeController.php index f2c8725f5..2c5ab9107 100644 --- a/app/Controllers/MuV2/NodeController.php +++ b/app/Controllers/MuV2/NodeController.php @@ -16,6 +16,7 @@ public function users($request, $response, $args) { $users = User::all(); $res = [ + 'ret' => 1, 'msg' => 'ok', 'data' => $users, ]; diff --git a/app/Services/Config.php b/app/Services/Config.php new file mode 100644 index 000000000..53760fe85 --- /dev/null +++ b/app/Services/Config.php @@ -0,0 +1,14 @@ +get($key); + } +} \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 277d0fd75..0fbfb7ee0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,6 +4,8 @@ services: redis: restart: always image: redis:latest + ports: + - 6379:6379 container_name: sspanel_redis command: - --loglevel warning @@ -11,15 +13,19 @@ services: - ./redis_data:/var/lib/redis:Z mysql: + restart: always image: mysql container_name: sspanel_mysql environment: - MYSQL_ROOT_PASSWORD=sspanel - MYSQL_DATABASE=sspanel + - MYSQL_USER=sspanel + - MYSQL_PASSWORD=sspanel volumes: - ./mysql_data:/var/lib/mysql:Z ss-panel: + restart: always image: orvice/ss-panel:master ports: - 8080:80 diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 0f0eecb73..90472a3f6 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -1,5 +1,16 @@ #!/bin/bash echo "Entry ss-panel" + +echo -n "waiting for MySQL connection..." + +while ! nc -w 1 $DB_HOST 3306 > /dev/null 2>&1 +do + echo -n . + sleep 1 +done + +echo 'ok' + if [ "$MIGRATION" = "false" ];then echo "Skip database migration" else