From f0e5b09f2769fb89ef5d6144ef790579fa703538 Mon Sep 17 00:00:00 2001 From: Damien Zammit Date: Tue, 3 Aug 2021 20:02:33 +1000 Subject: docker: Add basic configuration for running local php5 instance --- config-docker.patch | 81 +++++++++++++++++++++++++++++++++++++++++++++++++++++ docker-compose.yml | 14 +++++++++ readme-php5.sh | 21 ++++++++++++++ 3 files changed, 116 insertions(+) create mode 100644 config-docker.patch create mode 100644 docker-compose.yml create mode 100755 readme-php5.sh diff --git a/config-docker.patch b/config-docker.patch new file mode 100644 index 0000000..34f8f8b --- /dev/null +++ b/config-docker.patch @@ -0,0 +1,81 @@ +diff --git a/h-source/.htaccess b/h-source/.htaccess +index 56ccf22..61012e2 100755 +--- a/h-source/.htaccess ++++ b/h-source/.htaccess +@@ -1,7 +1,7 @@ + RewriteEngine On + +-RewriteCond %{HTTPS} !^on$ +-RewriteRule (.*) https://www.h-node.org/$1 [R,L] ++#RewriteCond %{HTTPS} !^on$ ++#RewriteRule (.*) https://www.h-node.org/$1 [R,L] + + # + # Options +FollowSymlinks +diff --git a/h-source/Application/Hooks/BeforeChecks.php b/h-source/Application/Hooks/BeforeChecks.php +index 6f200e6..47e7936 100755 +--- a/h-source/Application/Hooks/BeforeChecks.php ++++ b/h-source/Application/Hooks/BeforeChecks.php +@@ -13,7 +13,7 @@ if (!defined('EG')) die('Direct access not allowed!'); + + Params::$htmlentititiesCharset = "UTF-8"; + +-Params::$useHttps = true; ++Params::$useHttps = false; + + Params::$allowedSanitizeFunc .= ",sanitizeString,sanitizeAlphanum"; + +diff --git a/h-source/Config/Config.php b/h-source/Config/Config.php +index bea5562..1290751 100755 +--- a/h-source/Config/Config.php ++++ b/h-source/Config/Config.php +@@ -23,10 +23,10 @@ + if (!defined('EG')) die('Direct access not allowed!'); + + +-define('DB', ''); +-define('USER', ''); ++define('DB', 'hnode'); ++define('USER', 'root'); + define('PWD', ''); +-define('HOST', ''); ++define('HOST', 'localhost'); + + /*default controller name*/ + define('DEFAULT_CONTROLLER','home'); +@@ -35,7 +35,7 @@ define('DEFAULT_CONTROLLER','home'); + define('DEFAULT_ACTION','index'); + + /*website parameters*/ +-define('DOMAIN_NAME','h-source'); ++define('DOMAIN_NAME','localhost'); + + /*type of database.*/ + //it can be: Mysql, Mysqli or None (first letter in uppercase) +diff --git a/h-source/admin/Config/Config.php b/h-source/admin/Config/Config.php +index 24d2e57..3f7866d 100755 +--- a/h-source/admin/Config/Config.php ++++ b/h-source/admin/Config/Config.php +@@ -6,10 +6,10 @@ + if (!defined('EG')) die('Direct access not allowed!'); + + +-define('DB', ''); +-define('USER', ''); ++define('DB', 'hnode'); ++define('USER', 'root'); + define('PWD', ''); +-define('HOST', ''); ++define('HOST', 'localhost'); + + /*default controller name*/ + define('DEFAULT_CONTROLLER','adminusers'); +@@ -18,7 +18,7 @@ define('DEFAULT_CONTROLLER','adminusers'); + define('DEFAULT_ACTION','login'); + + /*website parameters*/ +-define('DOMAIN_NAME','h-source/admin'); ++define('DOMAIN_NAME','localhost/admin'); + + /*type of database.*/ + //it can be: Mysql, Mysqli or None (first letter in uppercase) diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..3b70319 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,14 @@ +# Image for LAMP based on Dockerfile in https://github.com/jakejarvis/docker-lamp-php5 +# WARNING: Not suitable for production environments, only for testing legacy php5 application. +# (Docker image supplementary files licenced under Apache 2.0) + +version: "3" +services: + lamp-php5: + image: docker.io/jakejarvis/lamp-php5:latest + ports: + - 80:80 + - 3306:3306 + volumes: + - "./h-source:/app" + - "./mysql:/var/lib/mysql" diff --git a/readme-php5.sh b/readme-php5.sh new file mode 100755 index 0000000..d401f23 --- /dev/null +++ b/readme-php5.sh @@ -0,0 +1,21 @@ +#!/bin/bash +# +# INSTRUCTIONS for testing with docker-lamp-php5: +# +# After the docker container spins up, +# the mysql password will be displayed. +# - MySQL on port 3306 +# - Apache on port 80 +# +# Don't forget to create the database: +# mysql -uadmin -pXXX -h127.0.0.1 +# > create database hnode; +# > ^D +# and populate the schema/initial data with: +# mysql -uadmin -pXXX -h127.0.0.1 hnode < h-source/tables.sql +# mysql -uadmin -pXXX -h127.0.0.1 hnode < h-source/admin/tables.sql + +patch -p1 < config-docker.patch + +docker-compose up --build lamp-php5 + -- cgit v1.2.3