mirror of
https://github.com/easychen/pushdeer.git
synced 2024-11-01 08:09:19 +08:00
add serverless docker file
This commit is contained in:
parent
bfcf22fcd8
commit
539a41da62
20
RoboFile.php
Normal file
20
RoboFile.php
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* This is project's console commands configuration for Robo task runner.
|
||||||
|
*
|
||||||
|
* @see http://robo.li/
|
||||||
|
*/
|
||||||
|
class RoboFile extends \Robo\Tasks
|
||||||
|
{
|
||||||
|
// define public methods as commands
|
||||||
|
public function buildDockerImage()
|
||||||
|
{
|
||||||
|
$tmp_dir = "/tmp/".md5(__DIR__);
|
||||||
|
$this->_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");
|
||||||
|
}
|
||||||
|
}
|
48
docker/web/config.yml
Executable file
48
docker/web/config.yml
Executable file
@ -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
|
25
docker/web/dockerfile.serverless
Normal file
25
docker/web/dockerfile.serverless
Normal file
@ -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
|
||||||
|
|
@ -3,7 +3,10 @@
|
|||||||
# 初始化 laravel
|
# 初始化 laravel
|
||||||
cd /app/api && composer install && cp -n .env.example .env && php artisan key:generate && php artisan migrate --seed
|
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
|
chmod -R 0777 /app/api/storage
|
||||||
|
|
||||||
|
mkdir -p /app/api/bootstrap/cache/
|
||||||
chmod -R 0777 /app/api/bootstrap/cache/
|
chmod -R 0777 /app/api/bootstrap/cache/
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
# Vhost
|
# Vhost
|
||||||
#######################################
|
#######################################
|
||||||
|
|
||||||
<VirtualHost *:80>
|
<VirtualHost *:80 *:9000>
|
||||||
ServerName docker.vm
|
ServerName docker.vm
|
||||||
ServerAlias *.vm
|
ServerAlias *.vm
|
||||||
DocumentRoot "/app/api/public"
|
DocumentRoot "/app/api/public"
|
||||||
|
Loading…
Reference in New Issue
Block a user