1 | <?php |
||
23 | class Module extends \yii\base\Module |
||
24 | { |
||
25 | |||
26 | /** |
||
27 | * @var bool Whether the container should attempt to run migrations on launch. |
||
28 | */ |
||
29 | public $runMigrations = false; |
||
30 | |||
31 | /** |
||
32 | * @var bool whether migrations should acquire a lock. |
||
33 | * It must be configured in the 'mutex' component of this module or the application |
||
34 | * Note that this mutex must be shared between all instances of your application. |
||
35 | * Consider using something like redis or mysql mutex. |
||
36 | */ |
||
37 | public $migrationsUseMutex = true; |
||
38 | |||
39 | /** |
||
40 | * The variables will be written to /runtime/env.json as JSON, where your application can read them. |
||
41 | * @var string[] List of required environment variables. If one is missing the container will exit. |
||
42 | * |
||
43 | */ |
||
44 | public $environmentVariables = []; |
||
45 | |||
46 | /** |
||
47 | * @var array Pool directives |
||
48 | * @see http://php.net/manual/en/install.fpm.configuration.php |
||
49 | * |
||
50 | */ |
||
51 | public $poolConfig = [ |
||
52 | 'user' => 'nobody', |
||
53 | 'group' => 'nobody', |
||
54 | 'listen' => 9000, |
||
55 | 'pm' => 'dynamic', |
||
56 | 'pm.max_children' => 40, |
||
57 | 'pm.start_servers' => 3, |
||
58 | 'pm.min_spare_servers' => 1, |
||
59 | 'pm.max_spare_servers' => 3, |
||
60 | 'access.log' => '/proc/self/fd/2', |
||
61 | 'clear_env' => 'yes', |
||
62 | 'catch_workers_output' => 'yes' |
||
63 | ]; |
||
64 | |||
65 | /** |
||
66 | * @var array PHP configuration, supplied via php_admin_value in fpm config. |
||
67 | */ |
||
68 | public $phpConfig = [ |
||
69 | 'upload_max_filesize' => '20M', |
||
70 | 'post_max_size' => '25M' |
||
71 | ]; |
||
72 | |||
73 | /** |
||
74 | * @var array Global directives |
||
75 | * @see http://php.net/manual/en/install.fpm.configuration.php |
||
76 | * |
||
77 | */ |
||
78 | public $fpmConfig = [ |
||
79 | 'error_log' => '/proc/self/fd/2', |
||
80 | 'daemonize' => 'no', |
||
81 | ]; |
||
82 | |||
83 | /** |
||
84 | * List of OS packages to install |
||
85 | */ |
||
86 | public $packages = [ |
||
87 | 'php7', |
||
88 | 'php7-fpm', |
||
89 | 'tini', |
||
90 | 'ca-certificates', |
||
91 | /** |
||
92 | * @see https://stedolan.github.io/jq/ |
||
93 | * This is used for converting the env to JSON. |
||
94 | */ |
||
95 | 'jq' |
||
96 | ]; |
||
97 | |||
98 | /** |
||
99 | * List of php extensions to install |
||
100 | */ |
||
101 | public $extensions = [ |
||
102 | 'ctype', |
||
103 | 'gd', |
||
104 | 'iconv', |
||
105 | 'intl', |
||
106 | 'json', |
||
107 | 'mbstring', |
||
108 | 'session', |
||
109 | 'pdo_mysql', |
||
110 | 'session', |
||
111 | 'curl' |
||
112 | ]; |
||
113 | |||
114 | /** |
||
115 | * @var string The name of the created image. |
||
116 | */ |
||
117 | public $image; |
||
118 | |||
119 | /** |
||
120 | * @var string The tag of the created image. |
||
121 | */ |
||
122 | public $tag = 'latest'; |
||
123 | |||
124 | /** |
||
125 | * @var bool wheter to push successful builds. |
||
126 | */ |
||
127 | public $push = false; |
||
128 | |||
129 | /** |
||
130 | * @var string Location of composer.json / composer.lock |
||
131 | */ |
||
132 | public $composerFilePath = '@app/../'; |
||
133 | /** |
||
134 | * @return string A PHP-FPM config file. |
||
135 | */ |
||
136 | 3 | protected function createFpmConfig() |
|
162 | |||
163 | /** |
||
164 | * @return string A shell script that checks for existence of (non-empty) variables and runs php-fpm. |
||
165 | */ |
||
166 | 3 | protected function createEntrypoint(): string |
|
226 | |||
227 | 3 | public function createBuildContext(): Context |
|
278 | |||
279 | 3 | public function getLock(int $timeout = 0) |
|
294 | |||
295 | /** |
||
296 | * @throws InvalidConfigException in case the app is not configured as expected |
||
297 | * @return string the relative path of the (console) entry script with respect to the project (not app) root. |
||
298 | */ |
||
299 | 3 | public function getConsoleEntryScript(): string |
|
308 | |||
309 | |||
310 | 1 | public function __set($name, $value) |
|
318 | |||
319 | 1 | private function add($name, array $value) |
|
326 | } |
||
327 |