Drupal 10, the latest version of the open-source digital experience platform with even more features, is here.A question from irc:
maelstrom> hi folks I have another tricky question, can aegir connect to mysql server via an ssh tunneling? the mySql server is bhind a ssh bastion any help is appreciated ;)
The answer turned out to be YES you can.
I'm dumping my thoughts here to maybe add it to documentation later....
Start with the regular remote server docs from http://docs.aegirproject.org/en/3.x/usage/advanced/remote-servers/#remot...
1) Setup the remote MySQL server to listen to an alternate port, 3312 in this example ( in /etc/mysql/my.cnf)
2) Add a line to /etc/hosts on both master and slave server
127.0.0.2 myremoteserver.example.com.mysql
3) Add the tunnel to your ssh config in ~/.ssh/config
Host myremoteserver.example.com
LocalForward 127.0.0.1:3312 127.0.0.1:33124) ssh to myremoteserver.example.com to open the tunnel ... somewhere in screen? Or any other means of keeping the tunnel active.
5) add a 'Web' server 'node' in hostmaster to myremoteserver.example.com
6) add a 'Database' server 'node' in hostmaster, using the sepecial myremoteserver.example.com.mysql name
7) add a platform on the remote server
8) Add a site as usual on the remote servers










Comments
Comment #2
helmo CreditAttribution: helmo at Initfour websolutions commentedIt's a bit of a drawback that mysql needs to listen on the special port remotely as well. That could conflict if it's also used for other applications.
As MySQL does not support listening on multiple ports you could use iptables to forward the port on the remote server ... see http://stackoverflow.com/questions/790242/how-to-add-a-port-to-mysql-server
Comment #3
SamirMtl CreditAttribution: SamirMtl commentedThanks Helmo
It just work fine ;)
In addition, the ~/.ssh/config file can be look like thisSo there are no need to configure mysql port of the server, which prevents any conflict with other applicationsAnother interesting point to deal with the ssh tunneling and launching a permanent one, please see this link : http://www.harding.motd.ca/autossh/
Comment #4
helmo CreditAttribution: helmo at Initfour websolutions commented@SamirMtl: Were you able to install and verify an new site on the remote server? I had the errors from Drupal connecting to port 3312 on the remote server itself.
Comment #5
SamirMtl CreditAttribution: SamirMtl commented@helmo you're right
i have supposed that if i can do somthing like this as aegir user : mysql -u -p -P 3312 --host=
so aegir server can perform the remote database connection
But on adding database server on aegir i have an error (.. Can't connect to MySQL serve..)
Comment #6
colan