Since a few weeks I'm exploring and learning OpenShift Origin. It's a very interesting technology and also makes me happy to learn new technologies like Docker and Kubernetes.
Last week Drupal released version 8 of their platform. This was a good
reason to try if I can get it running on OpenShift without too much work. In the end, this is the command I found to get it (basically) running:
oc new-app php~https://github.com/tobru/drupal-openshift.git#openshift mysql --group=php+mysql -e MYSQL_USER=drupal -e MYSQL_PASSWORD=drupalPW -e MYSQL_DATABASE=drupal
At first sight it looks complicated, but digging a bit into the command, it suddenly starts to make sense:
- oc: Name of the commandline OpenShift client
- new-app: Subcommand to create a new application in OpenShift
- php~: Tells which build container to use (could also be left out, then the S2I process tries to find out which one to use)
- https://github.com/tobru/drupal-openshift.git: Path to the git repository with the app source which gets cloned and used
- #openshift: Git reference to use. In this case the
openshift
branch - mysql: Another application to use, in this case a MySQL container
- --group=php+mysql: Group the two applications together in a POD
- -e: Environment variables which are used during container runtime
This long commands builds and deploys a Drupal 8 app ready to get used. On the first access Drupal presents the installation wizard. After going through it the application is ready to be used.
I had some troubles to get Drupal running, because Drupal wants to have a settings.php
which is not available by default in the source code. And there are some incompatible PHP settings in the default OpenShift PHP container which I had to hack into settings.php
. There are of course much better ways to get Drupal running on OpenShift, this is in no way production ready. I'll keep working (and learning). Makes fun!