# on a debian 9 fresh VM ssh -A intarnet@intarnet.fr # "fork" from CHD' git repos git config --global -e git clone root@chd.sx:/var/git/chd_gestion cd ~/chd_gestion/ git checkout a6104f4 git checkout -b cake36 editor app-from-scratch.sh # Adding notes progressively # env setup sudo apt --yes install php-cli apache2 libapache2-mod-php php-mbstring php-intl php-xml php-sqlite3 phpmyadmin mariadb-server unzip sudo a2disconf phpmyadmin sudo apache2 restart sudo mkdir /var/www/intarnet.fr sudo chown intarnet: /var/www/intarnet.fr # composer install wget -q https://getcomposer.org/composer.phar -O ~/bin/composer.phar chmod +x ~/bin/composer.phar echo 'export PATH="$PATH:~/bin"' >> ~/.bashrc source ~/.bashrc composer.phar --version # Composer version 1.7-dev (006c921abde5a9fa5ec682014265e3203a0987b1) 2018-07-12 20:08:52 # cake install cd ~/chd_gestion/ mkdir fai_gestion yes | composer.phar create-project --prefer-dist cakephp/app fai_gestion ln -s ~intarnet/chd_gestion/fai_gestion/bin/cake ~/bin/ cd ~/chd_gestion/fai_gestion cake version # 3.6.7 # cake first start (embed webserver) cake server -p 8080 # from desktop linux : # ssh -L 8080:localhost:8080 intarnet@intarnet.fr # firefox http://localhost:8080/ # -> everything green except database connection ^C # prepare for apache2 ln -s ~intarnet/chd_gestion/fai_gestion /var/www/intarnet.fr/gestion sudo chgrp -R www-data tmp/ logs/ sudo chmod -R ug=rwX,o=rX tmp/ logs/ # (cake bake runs with intarnet user, web served pages with www-data) # do NOT allow www-data write elsewhere sudo mv logs /var/log/fai_gestion ln -s /var/log/fai_gestion logs # apache2 vhost excerpt # Alias "/gestion" "/var/www/intarnet.fr/gestion/webroot" # # Options None # AllowOverride None # Require all denied # # # Options SymLinksIfOwnerMatch # AllowOverride None # # AuthType Basic # AuthName "Partie privee" # AuthUserFile /etc/apache2/passwords/intarnet.fr/www_priv.passwd # Require valid-user # # SetEnv APP_DEFAULT_LOCALE fr_FR # SetEnv DEBUG true # # RequestHeader unset Proxy # RewriteEngine On # RewriteCond %{REQUEST_FILENAME} !-f # RewriteRule ^ index.php [L] # sudo a2enmod env headers rewrite sudo service apache2 restart # from desktop linux : # firefox https://intarnet.fr/gestion/ # -> everything green except database connection cd ~/chd_gestion/ cat fai_gestion/.gitignore git add app-from-scratch.sh fai_gestion git commit -m "Cake 3.6.7 fresh install" # Cake startup configuration sed --in-place -e 's#^/config/app.php#/config/app_credentials.php#' fai_gestion/.gitignore git add app-from-scratch.sh fai_gestion/.gitignore fai_gestion/config/app.php git commit -m "Config : add app.php to git without credentials" cat > config/app_credentials.php <<"EOT" [ 'salt' => env('SECURITY_SALT', 'hexhexhexhexhexhexhexhexhexhexhexhexhexhexhexhexhexhexhexhexhexh'), ], 'Datasources' => [ 'default' => [ 'className' => 'Cake\Database\Connection', 'driver' => 'Cake\Database\Driver\Mysql', 'persistent' => false, 'host' => 'localhost', 'username' => 'my_app', 'password' => 'secret', 'database' => 'my_app', 'timezone' => 'UTC', 'cacheMetadata' => true, 'log' => false, 'quoteIdentifiers' => false, ], ], ]; EOT