diff --git a/RoboFile.php b/RoboFile.php new file mode 100644 index 0000000..6f226b7 --- /dev/null +++ b/RoboFile.php @@ -0,0 +1,20 @@ +_copyDir('docker', $tmp_dir.'/app/docker'); + $this->_copyDir('api', $tmp_dir.'/app/docker/web/api'); + $this->_copyDir('push', $tmp_dir.'/app/docker/web/push'); + $this->_exec("cd $tmp_dir/app && docker build -f ./docker/web/dockerfile.serverless -t pushdeercore ./docker/web "); + $this->_exec("docker tag pushdeercore ccr.ccs.tencentyun.com/ftqq/pushdeercore"); + $this->_exec("docker push ccr.ccs.tencentyun.com/ftqq/pushdeercore"); + } +} diff --git a/docker/web/config.yml b/docker/web/config.yml new file mode 100755 index 0000000..b072d09 --- /dev/null +++ b/docker/web/config.yml @@ -0,0 +1,48 @@ +core: + enabled: true # enable httpd server + address: "127.0.0.1" # ip address to bind (default: any) + shutdown_timeout: 30 # default is 30 second + port: "8888" # ignore this port number if auto_tls is enabled (listen 443). + sync: false + max_notification: 1 + cert_path: "c.p12" + key_path: "" + cert_base64: "" + key_base64: "" + http_proxy: "" + pid: + enabled: false + path: "gorush.pid" + override: true + +api: + push_uri: "/api/push" + stat_go_uri: "/api/stat/go" + stat_app_uri: "/api/stat/app" + config_uri: "/api/config" + sys_stat_uri: "/sys/stats" + metric_uri: "/metrics" + health_uri: "/healthz" + +ios: + enabled: true + key_path: "c.p12" + key_base64: "" # load iOS key from base64 input + key_type: "p12" # could be pem, p12 or p8 type + password: "8;RkkZzRdYuUBvurNyZW" # certificate password, default as empty string. + production: false + max_concurrent_pushes: 100 # just for push ios notification + max_retry: 0 # resend fail notification, default value zero is disabled + key_id: "66M7BD2GCV" # KeyID from developer account (Certificates, Identifiers & Profiles -> Keys) + team_id: "HUJ6HAE4VU" # TeamID from developer account (View Account -> Membership) + +log: + format: "string" # string or json + access_log: "stdout" # stdout: output to console, or define log path like "log/access_log" + access_level: "debug" + error_log: "stderr" # stderr: output to console, or define log path like "log/error_log" + error_level: "error" + hide_token: true + +stat: + engine: "memory" # support memory, redis, boltdb, buntdb or leveldb \ No newline at end of file diff --git a/docker/web/dockerfile.serverless b/docker/web/dockerfile.serverless new file mode 100644 index 0000000..9079420 --- /dev/null +++ b/docker/web/dockerfile.serverless @@ -0,0 +1,25 @@ +FROM webdevops/php-apache:8.0 + +# 首先配置 vhost +COPY vhost.conf /opt/docker/etc/httpd/vhost.conf +# COPY web.vhost.conf /opt/docker/etc/httpd/vhost.common.d/ + +# 然后运行初始化脚本 +# https://dockerfile.readthedocs.io/en/latest/content/Customization/provisioning.html +COPY init.sh /opt/docker/provision/entrypoint.d/ +#CMD chmod +x /opt/docker/provision/entrypoint.d/init.sh + +# ADD supervisord-proxy.conf /opt/docker/etc/supervisor.d/prism-proxy.conf +RUN mkdir /data +COPY gorush /data/gorush +RUN chmod +x /data/gorush + +COPY api /app/api +COPY push /app/push +# ADD ../../push /app/push + +ADD supervisord-ios.conf /opt/docker/etc/supervisor.d/push-ios.conf +ADD supervisord-clip.conf /opt/docker/etc/supervisor.d/push-clip.conf + +EXPOSE 80 + diff --git a/docker/web/init.sh b/docker/web/init.sh index 8eba260..4f20730 100644 --- a/docker/web/init.sh +++ b/docker/web/init.sh @@ -3,7 +3,10 @@ # 初始化 laravel cd /app/api && composer install && cp -n .env.example .env && php artisan key:generate && php artisan migrate --seed +mkdir -p /app/api/storage chmod -R 0777 /app/api/storage + +mkdir -p /app/api/bootstrap/cache/ chmod -R 0777 /app/api/bootstrap/cache/ diff --git a/docker/web/vhost.conf b/docker/web/vhost.conf index 35f6ae3..ba73caf 100644 --- a/docker/web/vhost.conf +++ b/docker/web/vhost.conf @@ -2,7 +2,7 @@ # Vhost ####################################### - + ServerName docker.vm ServerAlias *.vm DocumentRoot "/app/api/public"