Skip to content
Snippets Groups Projects
Commit bb90d82d authored by Hahn Axel (hahn)'s avatar Hahn Axel (hahn)
Browse files

Merge branch 'fix-missing-files' into 'main'

Fix missing files

See merge request !3
parents bc919acd 59ef23fb
No related branches found
No related tags found
1 merge request!3Fix missing files
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
# 2022-11-16 v1.2 <www.axel-hahn.de> use docker-compose -p "$APP_NAME" # 2022-11-16 v1.2 <www.axel-hahn.de> use docker-compose -p "$APP_NAME"
# 2022-12-18 v1.3 <www.axel-hahn.de> add -p "$APP_NAME" in other docker commands # 2022-12-18 v1.3 <www.axel-hahn.de> add -p "$APP_NAME" in other docker commands
# 2022-12-20 v1.4 <axel.hahn@unibe.ch> replace fgrep with grep -F # 2022-12-20 v1.4 <axel.hahn@unibe.ch> replace fgrep with grep -F
# 2023-03-06 v1.5 <www.axel-hahn.de> up with and without --build
# 2023-08-17 v1.6 <www.axel-hahn.de> menu selection with single key (without return)
# ====================================================================== # ======================================================================
cd $( dirname $0 ) cd $( dirname $0 )
...@@ -17,7 +19,7 @@ cd $( dirname $0 ) ...@@ -17,7 +19,7 @@ cd $( dirname $0 )
# git@git-repo.iml.unibe.ch:iml-open-source/docker-php-starterkit.git # git@git-repo.iml.unibe.ch:iml-open-source/docker-php-starterkit.git
selfgitrepo="docker-php-starterkit.git" selfgitrepo="docker-php-starterkit.git"
_version="1.4" _version="1.6"
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
# FUNCTIONS # FUNCTIONS
...@@ -226,8 +228,14 @@ function _showInfos(){ ...@@ -226,8 +228,14 @@ function _showInfos(){
echo echo
} }
# helper for menu: print an inverted key
function _key(){
printf "\e[4;7m ${1} \e[0m"
}
# helper: wait for a return key
function _wait(){ function _wait(){
echo -n "... press RETURN > "; read dummy echo -n "... press RETURN > "; read -r
} }
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
...@@ -245,21 +253,25 @@ while true; do ...@@ -245,21 +253,25 @@ while true; do
_showContainers _showContainers
h2 MENU h2 MENU
echo " g - remove git data of starterkit" echo " $( _key g ) - remove git data of starterkit"
echo
echo " $( _key i ) - init application: set permissions"
echo " $( _key t ) - generate files from templates"
echo " $( _key T ) - remove generated files"
echo echo
echo " i - init application: set permissions" echo " $( _key u ) - startup containers docker-compose ... up -d"
echo " t - generate files from templates" echo " $( _key U ) - startup containers docker-compose ... up -d --build"
echo " T - remove generated files" echo " $( _key s ) - shutdown containers docker-compose stop"
echo " $( _key r ) - remove containers docker-compose rm -f"
echo echo
echo " u - startup containers docker-compose up -d" echo " $( _key m ) - more infos"
echo " s - shutdown containers docker-compose stop" echo " $( _key c ) - console (bash)"
echo " r - remove containers docker-compose rm -f"
echo echo
echo " m - more infos" echo " $( _key q ) - quit"
echo " c - console (bash)"
echo echo
echo -n " select >" echo -n " select >"
read action read -rn 1 action
echo
fi fi
case "$action" in case "$action" in
...@@ -277,18 +289,22 @@ while true; do ...@@ -277,18 +289,22 @@ while true; do
_removeGeneratedFiles _removeGeneratedFiles
rm -rf containers rm -rf containers
;; ;;
f) # not in the menu
_removeGeneratedFiles # f)
_generateFiles # _removeGeneratedFiles
_wait # _generateFiles
;; # _wait
# ;;
m) m)
_showInfos _showInfos
_wait _wait
;; ;;
u) u|U)
if docker-compose -p "$APP_NAME" --verbose up -d --remove-orphans --build; then dockerUp="docker-compose -p "$APP_NAME" --verbose up -d --remove-orphans"
# test ! -z "${APP_ONSTARTUP}" && sleep 2 && docker exec -it appmonitor-server /bin/bash -c "${APP_ONSTARTUP}" if [ "$action" = "U" ]; then
dockerUp+=" --build"
fi
if $dockerUp; then
echo "In a web browser:" echo "In a web browser:"
echo " $frontendurl" echo " $frontendurl"
else else
...@@ -311,7 +327,11 @@ while true; do ...@@ -311,7 +327,11 @@ while true; do
read dockerid read dockerid
test -z "$dockerid" || docker exec -it $dockerid /bin/bash test -z "$dockerid" || docker exec -it $dockerid /bin/bash
;; ;;
*) echo "ACTION [$action] NOT IMPLEMENTED." q)
exit 0;
;;
*)
test -n "$action" && ( echo " ACTION FOR [$action] NOT IMPLEMENTED."; sleep 1 )
esac esac
action= action=
done done
......
## Start from scratch ## First steps
This project contains files for docker, the docs and webroot with a demo of implemented components.
To bring up and running:
You need
* a rootless docker instance (if it is working with docker as root I didn't tested).
* docker compose
* facl
Steps:
* start ./docker/init.sh
* press ``i`` to apply write permissions with setfacl command
* press ``u`` to startup the container
In your browser open http://localhost:8008/.
## Start a new project using demo page
Steps:
* delete the directories .git + docs
* delete the files .gitignore + readme.md
## Start from scratch (WIP)
If you have no AdminLTE page and want to jump in from point zero: If you have no AdminLTE page and want to jump in from point zero:
......
<?php
class pageinclude{
protected $_request;
protected $_sPageFile;
protected $_sPagesDir;
/**
* init
* @return bool
*/
public function __construct(){
$this->_sPagesDir=__DIR__.'/../pages/';
return true;
}
protected function _detectPagefile(){
$_request=$_SERVER['REQUEST_URI'];
$sPagefile=preg_replace('/\?.*$/', '', $_request);
if($sPagefile=="/"){
$sPagefile="/index";
}
return $sPagefile.=".php";
}
/**
* set another base dir for pages
* @param string $sDir path of the new pages dir
* @return bool
*/
public function setPagedir($sDir){
if(is_dir($sDir)){
$this->_sPagesDir=$sDir;
return true;
}
return false;
}
public function getPage(){
$this->_sPageFile=$this->_detectPagefile();
ob_start();
// echo "$this->_sPagesDir.$this->_sPageFile<br>";
if (!@include($this->_sPagesDir.$this->_sPageFile)) {
echo "$this->_sPagesDir.$this->_sPageFile<br>";
@include($this->_sPagesDir."error_404.php");
}
$sPhpOut = ob_get_contents();
ob_end_clean();
return $sPhpOut;
}
}
\ No newline at end of file
<?php
// icons: https://fontawesome.com/v5/search?o=r&m=free
return [
['href'=>'#', 'label'=>'Menu A', 'icon'=>'fas fa-home' ],
['href'=>'#', 'label'=>'Menu B', 'icon'=>'fas fa-tv'],
['href'=>'#', 'label'=>'Menu C', 'icon'=>'fas fa-truck-pickup',
'children'=>[
['href'=>'#', 'label'=>'FAQ' , 'icon'=>'fas fa-truck-monster'],
['href'=>'#', 'label'=>'Support' , 'icon'=>'fas fa-truck-moving'],
]
]
];
\ No newline at end of file
<?php
// icons: https://fontawesome.com/v5/search?o=r&m=free
return [
['href'=>'/index.php', 'label'=>'MyHome' , 'icon'=>'fas fa-home', 'class'=>'bg-gray'],
['href'=>'#', 'label'=>'Contact' ],
['href'=>'#', 'label'=>'Help',
'children'=>[
['href'=>'#', 'label'=>'FAQ'],
['label'=>'-'],
['href'=>'#', 'label'=>'Support'],
]
]
];
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment