Loading...
 

Tiki deployement - Experiment with appsdeck

Tiki deployement - Experiment with appsdeck


Plan/general idea 


Install from scratch with svn version 12.x on appsdeck.eu (now renamed https://scalingo.com/ )
https://appsdeck.eu is currently in beta. Anyone can experiment for free, even when prices are mentioned. Pricing is also not final yet (should get lower).
Name will change before the offering goes public and gets really paying.

Create local git depot 

libs@tanelorn:~$ cp -r  /tiki/tiki_sf/branches/12.x alsawiki_share/projets/appsdeck/


Verify that we have composer.json at the root
Yes we do.
This is good because appsdeck can handle it. No need to provide the vendors directory.

libs@tanelorn:~/alsawiki_share/projets/appsdeck/12.x$ git init
Initialized empty Git repository in /home/libs/alsawiki_share/projets/appsdeck/12.x/.git/
libs@tanelorn:~/alsawiki_share/projets/appsdeck/12.x$ git add .
libs@tanelorn:~/alsawiki_share/projets/appsdeck/12.x$ git commit -m "First commit"

*** Please tell me who you are.

Run

  git config --global user.email "you@example.com"
  git config --global user.name "Your Name"

to set your account's default identity.
Omit --global to set the identity only in this repository.

fatal: unable to auto-detect email address (got 'libs@tanelorn.(none)')
libs@tanelorn:~/alsawiki_share/projets/appsdeck/12.x$ git config --global user.email "jyhem@tiki.org"
libs@tanelorn:~/alsawiki_share/projets/appsdeck/12.x$ git config --global user.name "Jean-Marc Libs"
libs@tanelorn:~/alsawiki_share/projets/appsdeck/12.x$ git commit -m "First commit"

Create project on appsdeck 


https://appsdeck.eu/
Get an account. Mine is jyhem
Make sure to share some public key for further command line communication.
Create a new application: jyhem-tiki-12

Get next commands on appsdeck website

Get addons from appsdeck 


https://appsdeck.eu/home/apps/jyhem-tiki-12#addons-tab
→ mysql

Info returned after mysql creation:
APPSDECK_MYSQL_URL: mysql://jyhem_tiki__5479:xxxxxxxxxxxxxxxxxxxx@epsilon.appsdeck.eu:30005/jyhem_tiki__5479

Add from previous the env variable:
MYSQLCONNSTR_Tiki: Database=jyhem_tiki__5479;Data Source=epsilon.appsdeck.eu:30005;User Id=jyhem_tiki__5479;Password=xxxxxxxxxxxxxxxxxxxxxx

Tiki side
Ref: https://doc.tiki.org/System+Configuration
Create db/tiki.ini with appropriate info

Well, not necessary.

Remove the .svn directories from the git repo 


Should have been done earlier:

echo '.svn' > .gitignore
find ./ -type d -name .svn -print0 | xargs -0 git rm --cached -r
git status
git commit -a -m "delete svn files from git cache"
git status
git add .
git status
git commit -a -m "ignore svn files"

Actually send on the website 

libs@tanelorn:~/alsawiki_share/projets/appsdeck/12.x$ git status
# On branch master
nothing to commit, working directory clean

libs@tanelorn:~/alsawiki_share/projets/appsdeck/12.x$ git push appsdeck master
Counting objects: 11074, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (10951/10951), done.
Writing objects: 100% (11074/11074), 28.68 MiB | 76 KiB/s, done.
Total 11074 (delta 1229), reused 0 (delta 0)

 <-- Start deployment of jyhem-tiki-12 -->

-----> Bundling NGINX 1.6.1
-----> Bundling PHP 5.5.15
-----> Bundling extensions
       apcu
       phpredis
       mongo
-----> Vendoring Composer
       Updating Composer
Updating to version 1e27ff5e22df81e3cd0cd36e5fdd4a3c5a031f4a.
    Downloading: 100%
Use composer self-update --rollback to return to version 28c65b5425f7f8722c260e3787b74c1ea6b37e3b
-----> Installing application dependencies with Composer
       Loading composer repositories with package information
       Installing dependencies from lock file
         - Installing afarkas/html5shiv (3.6.2)
           Downloading: 100%

         - Installing adodb/adodb (5.18)
           Downloading: 100%

         - Installing bombayworks/zendframework1 (v1.12.3)
           Downloading: 100%

         - Installing ckeditor/ckeditor (4.3.4)
           Downloading: 100%

…
…
…
         - Installing zetacomponents/webdav (1.1.3)
           Downloading: 100%

       Generating optimized autoload files
       Warning: Ambiguous class resolution, "Multilingual_Aligner_SentenceAlignments" was found in both "/build/lib/core/Multilingual/Aligner/SentenceAlignments.php" and "/build/lib/core/Multilingual/Aligner/SentenceAlignments3.php", the first will be used.
       Warning: Ambiguous class resolution, "Text_Wiki_Parse_Tt" was found in both "/build/vendor_extra/pear/Text/Wiki/Parse/Default/Tt.php" and "/build/vendor_extra/pear/Text/Wiki/Parse/Mediawiki/Tt.php", the first will be used.
…
       Warning: Ambiguous class resolution, "ADORecordSet_postgres64" was found in both "/build/vendor/adodb/adodb/drivers/drivers/adodb-postgres64.inc.php" and "/build/vendor/adodb/adodb/drivers/adodb-postgres64.inc.php", the first will be used.
-----> Setting up default configuration
-----> Vendoring binaries into slug
 Build complete, shipping your container...

 Waiting for your application to boot...

 <-- https://jyhem-tiki-12.appsdeck.eu -->
To git@appsdeck.eu:jyhem-tiki-12.git
 * [new branch]      master -> master


https://jyhem-tiki-12.appsdeck.eu Partial success ! :-)

→ Gets to installer

Tiki has detected your PHP memory_limit at: 128 MB.
No email because no sendmail binary existing or planned.

All looks good except that we can't exit the installer (with or without creating the lock file)
I assume the issue is, it does not let us create db/local.php

I assumed wrong: Creating files is not an issue by itself. Here, the issue is with port allocation
Working with Soulou, from appsdeck.eu

IRC log in french
[Thursday 14 August 2014] [16:53:05] <Soulou> donc
[Thursday 14 August 2014] [16:53:07] <Soulou> tiki
[Thursday 14 August 2014] [16:53:12] <Soulou> quand tu vas sur l'index.php
[Thursday 14 August 2014] [16:53:16] <Soulou> genere un $base_url
[Thursday 14 August 2014] [16:53:16] <Jyhem_laptop> non, ça passe pas bien, mais pas grave
[Thursday 14 August 2014] [16:53:33] <Soulou> ce $base_url se base sur les variabels $_SERVER
[Thursday 14 August 2014] [16:53:43] <Soulou> donc $_SERVER['SERVER_PORT']
[Thursday 14 August 2014] [16:54:06] <Soulou> or chez nosu on associe des ports arbitraires aux instances d'applications qui tournent
[Thursday 14 August 2014] [16:54:11] <Soulou> genre 40123
[Thursday 14 August 2014] [16:54:21] <Soulou> du coup l'index.php redirige vers
[Thursday 14 August 2014] [16:54:36] <Soulou> https://tiki.appsdeck.eu:40123/tiki_index.php
[Thursday 14 August 2014] [16:54:49] <Soulou> Il y a possibilite de le detecter
[Thursday 14 August 2014] [16:55:04] <Soulou> car le reverse proxy frontal cree le header
[Thursday 14 August 2014] [16:55:11] <Soulou> X_FORWARDED_PROTO pour l'application
[Thursday 14 August 2014] [16:55:20] <Soulou> comme ca elle sait si c'est port 80/443

[Thursday 14 August 2014] [17:39:10] <Soulou> car imagine
[Thursday 14 August 2014] [17:39:15] <Soulou> Quelqu'un a un tiki wiki chez nous
[Thursday 14 August 2014] [17:39:19] <Soulou> et utilise deux instances
[Thursday 14 August 2014] [17:39:22] <Soulou> pour avoir de la redondance
[Thursday 14 August 2014] [17:39:26] <Soulou> une va fonctionner sur
[Thursday 14 August 2014] [17:39:40] <Soulou> http://node1.internal.appsdeck.eu:40001
[Thursday 14 August 2014] [17:39:41] <Soulou> et l'autre sur
[Thursday 14 August 2014] [17:39:48] <Soulou> http://node23.internal.appsdeck.eu:40002
[Thursday 14 August 2014] [17:39:56] <Soulou> devant on a un load balancer
[Thursday 14 August 2014] [17:40:08] * Jyhem_laptop suit, continue
[Thursday 14 August 2014] [17:40:09] <Soulou> qui distribue les requetes de https://tikiwiki.appsdeck.eu
[Thursday 14 August 2014] [17:40:19] <Soulou> sur les deux instances
[Thursday 14 August 2014] [17:40:37] <Soulou> si l'une ou l'autre genere des informations
[Thursday 14 August 2014] [17:40:47] <Soulou> avec le numero du port dedans c'est un non sens
[Thursday 14 August 2014] [17:40:53] <Soulou> car si tu veux mettre a jour ton application
[Thursday 14 August 2014] [17:41:08] <Soulou> les instances vont etre sur http://node4.internal.appsdeck.eu:40032
[Thursday 14 August 2014] [17:41:13] <Soulou> et autre chose par exemple
[Thursday 14 August 2014] [17:41:18] <Soulou> c'est tres tres temporaire
[Thursday 14 August 2014] [17:41:31] <Soulou> donc dans notre cas SERVER_PORT est une information inutilisable
[Thursday 14 August 2014] [17:41:47] <Soulou> et en fait c'est le cas des qu'il y a un proxy devant un ou plusieurs instance de l'application
[Thursday 14 August 2014] [17:42:05] <Soulou> puisque le port utilise pour l'application elle meme n'est pas publique


I did it in :

Revision: 52330
          http://sourceforge.net/p/tikiwiki/code/52330
Author:   jyhem
Date:     2014-08-14 16:40:52 +0000 (Thu, 14 Aug 2014)
Log Message:
-----------
[FIX] Check if behind a Frontend-Proxie/Load-Balancer which rewrites ports (some cloud offerings need this) (thanks Soulou)

Modified Paths:
--------------
    trunk/lib/setup/absolute_urls.php

Modified: trunk/lib/setup/absolute_urls.php
===================================================================
--- trunk/lib/setup/absolute_urls.php   2014-08-14 11:42:37 UTC (rev 52329)
+++ trunk/lib/setup/absolute_urls.php   2014-08-14 16:40:52 UTC (rev 52330)
@@ -8,6 +8,15 @@
 //this script may only be included - so its better to die if called directly.
 $access->check_script($_SERVER['SCRIPT_NAME'], basename(__FILE__));

+// Check if behind a Frontend-Proxie/Load-Balancer which rewrites ports
+if (isset($_SERVER['HTTP_X_FORWARDED_PROTO'])) {
+       if ($_SERVER['HTTP_X_FORWARDED_PROTO'] == "http") {
+               $_SERVER['SERVER_PORT'] = 80;
+       } else if($_SERVER['HTTP_X_FORWARDED_PROTO'] == "https") {
+               $_SERVER['SERVER_PORT'] = 443;
+       }
+}
+
 // check if the current port is not 80 or 443
 if (isset($_SERVER['SERVER_PORT'])) {
        if (($_SERVER['SERVER_PORT'] != 80) && ($_SERVER['SERVER_PORT'] != 443)) {

So, to get Tiki running, until this is backported,
libs@tanelorn:~/alsawiki_share/projets/appsdeck/12.x$ svn merge -c 52330 https://svn.code.sf.net/p/tikiwiki/code/trunk/ .
libs@tanelorn:~/alsawiki_share/projets/appsdeck/12.x$ git add lib/setup/absolute_urls.php
libs@tanelorn:~/alsawiki_share/projets/appsdeck/12.x$ git commit -m "Support HTTP_X_FORWARDED_PROTO"
[master edd1a24] Support HTTP_X_FORWARDED_PROTO
 1 file changed, 9 insertions(+)
libs@tanelorn:~/alsawiki_share/projets/appsdeck/12.x$ git push appsdeck master
Counting objects: 9, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (5/5), done.
Writing objects: 100% (5/5), 628 bytes, done.
Total 5 (delta 4), reused 0 (delta 0)

 <-- Start deployment of jyhem-tiki-12 -->
-----> Bundling NGINX 1.6.1
       Checksums match. Fetching from cache.
-----> Bundling PHP 5.5.15
       Checksums match. Fetching from cache.
-----> Bundling extensions
       apcu
       Checksums match. Fetching from cache.
…
Build complete, shipping your container...
Waiting for your application to boot...

 <-- https://jyhem-tiki-12.appsdeck.eu -->
To git@appsdeck.eu:jyhem-tiki-12.git
   82fd4ff..edd1a24  master -> master

Other options 

filesystem storage 

This is not a blocker, since by default, Tiki ships with ''Storage: Store in database''
[Thursday 14 August 2014] [18:48:22] <Soulou> -c'est
[Thursday 14 August 2014] [18:48:44] <Soulou> https://api.ovh.com/openstack-swift-for-pcs-howto.xml
[Thursday 14 August 2014] [18:48:49] <Soulou> pour un swift chez OVH
[Thursday 14 August 2014] [18:48:56] <Soulou> https://aws.amazon.com/fr/s3/
[Thursday 14 August 2014] [18:48:59] <Soulou> pour un compte chez S3 :)

Troubleshooting 

http://sample-php-base.appsdeck.eu/

appsdeck --app jyhem-tiki-12 run bash
appsdeck --app jyhem-tiki-12 logs -f

Main issue: email 


They have no sendmail and they don't intend to have one.
So

  • the test emails in the installer fail
  • We need to configure SMTP email

Issue 

During the one test, sending emails using SMTP failed
We don't know if it's a Tiki issue or an appsdeck issue. Lack of time for more testing.
Tiki does not allow for useful logging of mail activities

Modifs et patchs 


File galleries 


Faut «un CDN ou bien un service type S3 ou OpenStack Switft»
sinon, http://jyhem-tiki-12.appsdeck.eu/tiki-admin.php?page=fgal et Storage: Store in database

Ref: https://github.com/tpyo/amazon-s3-php-class
Ref: https://api.ovh.com/openstack-swift-for-pcs-howto.xml

Elastic search (available as a paying appsdeck add-on) 


APPSDECK_ELASTICSEARCH_URL: http://jyhem-tiki-12_5287:xxxxxxxxxxxxxxx@epsilon.appsdeck.eu:30007

Note: I needed to add this in the list of hidden prefs so that the password is nor exposed in the tiki logs
(revision 52331 in 12, 13, 9)

Pricing 


Not final: http://scalingo-homepage-production.appsdeck.eu/pricing

Goodies 


https://github.com/Appsdeck/appsdeck-executables
Download latest

https://github.com/Appsdeck/appsdeck-executables/blob/master/0.3.4/appsdeck_0.3.4_amd64.deb
libs@tanelorn:~/xfers$ sudo dpkg -i appsdeck_0.3.4_amd64.deb
Selecting previously unselected package appsdeck.
(Reading database ... 313579 files and directories currently installed.)
Unpacking appsdeck (from appsdeck_0.3.4_amd64.deb) ...
Setting up appsdeck (0.3.4) ...

libs@tanelorn:~/xfers$ appsdeck
NAME:
   Appsdeck Client - Manage your apps and containers

USAGE:
   Appsdeck Client [global options] command [command options] [arguments...]

VERSION:
   0.3.4

COMMANDS:
   logs, l      Get the logs of your applications
   run, r       Run any command for your app
   apps, a      List your apps
   logout       Logout from Appsdeck
   create, c    Create a new app
   destroy, d   Destroy an app /!\
   help, h      Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --app, -a '<name>'   Name of the app
   --version, -v        print the version
   --help, -h           show help

libs@tanelorn:~/xfers$ appsdeck --app appsdeck apps
You need to be authenticated to user Appsdeck client.
No account ? → https://appsdeck.eu/users/sign_up
Username or email: jyhem
Password:
Hello Jean-Marc Libs, nice to see you !

List of your apps :
∘ wikilaplagedigitale —  (owner)
∘ convert —  (owner)
∘ jyhem-tiki-12 —  (owner)

Email testing 

With gmail SMTP 

Create gmail account 

jeanmarc.appsdeck at gmail.com
12345678Appsdeck!!toto

Tiki configuration 


Default charset for sending mail: utf-8
Mail end of line: LF
Mail Sender: SMTP
SMTP Server: smtp.gmail.com
Authentication: LOGIN
Username: jeanmarc.appsdeck at gmail.com
Password: 12345678Appsdeck!!toto
Port: 465
Security: SSL
Local server name: jyhem-tiki-12.appsdeck.eu
Mail Delivery: Send immediately

Test email 

Send: jeanmarc.appsdeck at gmail.com
Got email (then gmail froze the account demanding a working phone number)
Probable success !

With Hotmail SMTP 

Hotmail account 

gaston.trobas at gmail.com
Gaston123456RTYOPB
It definitely wants a phone number

gaston.trobas at hotmail.com
xxxxxxxx

Tiki config 


Ref: http://www.patshaping.de/hilfen_ta/pop3_smtp.htm

Mail end of line: LF
Mail Sender: SMTP
SMTP Server: smtp-mail.outlook.com
Authentication: LOGIN
Username: gaston.trobas at hotmail.com
Password: xxxxx
Port: 587
Security: TLS
Local server name: jyhem-tiki-12.appsdeck.eu
Mail Delivery: Send immediately

«Unable to send mail»

Port: 25
«Unable to send mail»

Security: SSL
Port: 25
«Unable to send mail»

Security: SSL
Port: 587
«Unable to send mail»

Why Register?

Register at tiki.org and you'll be able to use the account at any *.tiki.org site, thanks to the InterTiki feature. A valid email address is required to receive site notifications and occasional newsletters. You can opt out of these items at any time.