docker stuff
This commit is contained in:
parent
0f10e59e38
commit
6292f72032
0
core/Configuration/.gitignore
vendored
Executable file → Normal file
0
core/Configuration/.gitignore
vendored
Executable file → Normal file
0
core/Configuration/.htaccess
Executable file → Normal file
0
core/Configuration/.htaccess
Executable file → Normal file
0
core/Configuration/Configuration.class.php
Executable file → Normal file
0
core/Configuration/Configuration.class.php
Executable file → Normal file
0
core/Configuration/CreateDatabase.class.php
Executable file → Normal file
0
core/Configuration/CreateDatabase.class.php
Executable file → Normal file
@ -88,6 +88,10 @@ namespace Documents\Install {
|
|||||||
$this->steps = array();
|
$this->steps = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isDocker(): bool {
|
||||||
|
return file_exists("/.dockerenv");
|
||||||
|
}
|
||||||
|
|
||||||
private function getParameter($name): ?string {
|
private function getParameter($name): ?string {
|
||||||
if (isset($_REQUEST[$name]) && is_string($_REQUEST[$name])) {
|
if (isset($_REQUEST[$name]) && is_string($_REQUEST[$name])) {
|
||||||
return trim($_REQUEST[$name]);
|
return trim($_REQUEST[$name]);
|
||||||
@ -542,6 +546,10 @@ namespace Documents\Install {
|
|||||||
$attributes["max"] = $formItem["max"];
|
$attributes["max"] = $formItem["max"];
|
||||||
if (isset($formItem["step"]) && is_numeric($formItem["step"]))
|
if (isset($formItem["step"]) && is_numeric($formItem["step"]))
|
||||||
$attributes["step"] = $formItem["step"];
|
$attributes["step"] = $formItem["step"];
|
||||||
|
} else {
|
||||||
|
if (isset($formItem["default"])) {
|
||||||
|
$attributes["value"] = $formItem["default"];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -579,6 +587,12 @@ namespace Documents\Install {
|
|||||||
|
|
||||||
private function createProgessMainview(): string {
|
private function createProgessMainview(): string {
|
||||||
|
|
||||||
|
$isDocker = $this->isDocker();
|
||||||
|
$defaultHost = ($isDocker ? "db" : "");
|
||||||
|
$defaultUsername = ($isDocker ? "root" : "");
|
||||||
|
$defaultPassword = ($isDocker ? "webbasedb" : "");
|
||||||
|
$defaultDatabase = ($isDocker ? "webbase" : "");
|
||||||
|
|
||||||
$views = array(
|
$views = array(
|
||||||
self::CHECKING_REQUIREMENTS => array(
|
self::CHECKING_REQUIREMENTS => array(
|
||||||
"title" => "Application Requirements",
|
"title" => "Application Requirements",
|
||||||
@ -590,13 +604,13 @@ namespace Documents\Install {
|
|||||||
array("title" => "Database Type", "name" => "type", "type" => "select", "required" => true, "items" => array(
|
array("title" => "Database Type", "name" => "type", "type" => "select", "required" => true, "items" => array(
|
||||||
"mysql" => "MySQL", "postgres" => "PostgreSQL"
|
"mysql" => "MySQL", "postgres" => "PostgreSQL"
|
||||||
)),
|
)),
|
||||||
array("title" => "Username", "name" => "username", "type" => "text", "required" => true),
|
array("title" => "Username", "name" => "username", "type" => "text", "required" => true, "default" => $defaultUsername),
|
||||||
array("title" => "Password", "name" => "password", "type" => "password"),
|
array("title" => "Password", "name" => "password", "type" => "password", "default" => $defaultPassword),
|
||||||
array("title" => "Database", "name" => "database", "type" => "text", "required" => true),
|
array("title" => "Database", "name" => "database", "type" => "text", "required" => true, "default" => $defaultDatabase),
|
||||||
array("type" => "row", "items" => array(
|
array("type" => "row", "items" => array(
|
||||||
array(
|
array(
|
||||||
"title" => "Address", "name" => "host", "type" => "text", "required" => true,
|
"title" => "Address", "name" => "host", "type" => "text", "required" => true,
|
||||||
"value" => "localhost", "row" => true
|
"value" => "localhost", "row" => true, "default" => $defaultHost
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
"title" => "Port", "name" => "port", "type" => "number", "required" => true,
|
"title" => "Port", "name" => "port", "type" => "number", "required" => true,
|
||||||
|
28
docker-compose.yml
Normal file
28
docker-compose.yml
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
version: "3.9"
|
||||||
|
services:
|
||||||
|
web:
|
||||||
|
image: nginx:latest
|
||||||
|
ports:
|
||||||
|
- "80:80"
|
||||||
|
volumes:
|
||||||
|
- .:/application:rw
|
||||||
|
- ./docker/nginx/site.conf:/etc/nginx/conf.d/default.conf:ro
|
||||||
|
links:
|
||||||
|
- db
|
||||||
|
- php
|
||||||
|
db:
|
||||||
|
image: mariadb:latest
|
||||||
|
ports:
|
||||||
|
- '3306:3306'
|
||||||
|
environment:
|
||||||
|
- "MYSQL_ROOT_PASSWORD=webbasedb"
|
||||||
|
- "MYSQL_DATABASE=webbase"
|
||||||
|
php:
|
||||||
|
volumes:
|
||||||
|
- .:/application:rw
|
||||||
|
- ./docker/php/php.ini:/usr/local/etc/php/php.ini:ro
|
||||||
|
build:
|
||||||
|
context: './docker/php/'
|
||||||
|
links:
|
||||||
|
- db
|
||||||
|
|
1
docker/.htaccess
Normal file
1
docker/.htaccess
Normal file
@ -0,0 +1 @@
|
|||||||
|
DENY FROM ALL
|
46
docker/nginx/site.conf
Normal file
46
docker/nginx/site.conf
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
server {
|
||||||
|
index index.php index.html;
|
||||||
|
error_log /var/log/nginx/error.log;
|
||||||
|
access_log /var/log/nginx/access.log;
|
||||||
|
root /application;
|
||||||
|
|
||||||
|
# rewrite api
|
||||||
|
rewrite ^/api(/.*)$ /index.php?api=$1;
|
||||||
|
|
||||||
|
# deny access to .gitignore / .htaccess
|
||||||
|
location ~ /\. {
|
||||||
|
rewrite ^(.*)$ /index.php?site=$1;
|
||||||
|
}
|
||||||
|
|
||||||
|
# deny access to docker-compose.yml
|
||||||
|
location /docker-compose.yml {
|
||||||
|
rewrite ^(.*)$ /index.php?site=$1;
|
||||||
|
}
|
||||||
|
|
||||||
|
# deny access to specific directories
|
||||||
|
location ~ ^/(files/uploaded|adminPanel|fileControlPanel|docker|core)/.*$ {
|
||||||
|
rewrite ^(.*)$ /index.php?site=$1;
|
||||||
|
}
|
||||||
|
|
||||||
|
# try to find the specified file
|
||||||
|
location / {
|
||||||
|
try_files $uri $uri @redirectToIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
# redirect to index.php
|
||||||
|
location @redirectToIndex {
|
||||||
|
rewrite ^(.*)$ /index.php?site=$1;
|
||||||
|
}
|
||||||
|
|
||||||
|
# serve .php files
|
||||||
|
location ~ \.php$ {
|
||||||
|
try_files $uri =404;
|
||||||
|
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
||||||
|
fastcgi_pass php:9000;
|
||||||
|
fastcgi_index index.php;
|
||||||
|
include fastcgi_params;
|
||||||
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||||
|
fastcgi_param PATH_INFO $fastcgi_path_info;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
4
docker/php/Dockerfile
Normal file
4
docker/php/Dockerfile
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
FROM php:7-fpm
|
||||||
|
WORKDIR "/application"
|
||||||
|
|
||||||
|
RUN docker-php-ext-install mysqli
|
1950
docker/php/php.ini
Normal file
1950
docker/php/php.ini
Normal file
File diff suppressed because it is too large
Load Diff
@ -18,7 +18,7 @@ use Elements\Document;
|
|||||||
|
|
||||||
if (!is_readable(getClassPath(Configuration::class))) {
|
if (!is_readable(getClassPath(Configuration::class))) {
|
||||||
header("Content-Type: application/json");
|
header("Content-Type: application/json");
|
||||||
die(json_encode(array( "success" => false, "msg" => "Configuration directory is not readable, check permissions before proceeding." )));
|
die(json_encode(array( "success" => false, "msg" => "Configuration class is not readable, check permissions before proceeding." )));
|
||||||
}
|
}
|
||||||
|
|
||||||
$config = new Configuration();
|
$config = new Configuration();
|
||||||
|
Loading…
Reference in New Issue
Block a user