summaryrefslogtreecommitdiff
path: root/app-from-scratch.sh
diff options
context:
space:
mode:
Diffstat (limited to 'app-from-scratch.sh')
-rw-r--r--app-from-scratch.sh91
1 files changed, 91 insertions, 0 deletions
diff --git a/app-from-scratch.sh b/app-from-scratch.sh
new file mode 100644
index 0000000..418686d
--- /dev/null
+++ b/app-from-scratch.sh
@@ -0,0 +1,91 @@
+
+# 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 | php ~/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"
+# <Directory /var/www/intarnet.fr/gestion>
+# Options None
+# AllowOverride None
+# Require all denied
+# </Directory>
+# <Directory /var/www/intarnet.fr/gestion/webroot>
+# 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]
+# </Directory>
+
+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"
+