Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Deployment on OpenShift

  • bdeprez
  • bdeprez's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
7 years 3 months ago #145558 by bdeprez
Deployment on OpenShift was created by bdeprez
Dear all,

I was wondering if any of you have experience with running LimeSurvey on OpenShift?

We've been investigating and we can get it running without issues, however, I'm wondering how autoscaling would work...

With autoscaling, each pod that gets rolled out will come up with the 'installer screen' getting launched - I assume there must be a way to circumvent that. Would it be sufficient to just provide a config.php with the needed details? Or would something else be needed?

Any thoughts / experience / recommendations anybody could share?

Thanks,
B.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 3 months ago #145566 by DenisChenu
Replied by DenisChenu on topic Deployment on OpenShift
Hi,

You can install it in docker using php cli : manual.limesurvey.org/Installation_using...line_interface_(CLI)

Else : a lot of docker image

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
  • bdeprez
  • bdeprez's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
7 years 3 months ago #145753 by bdeprez
Replied by bdeprez on topic Deployment on OpenShift
Hi Denis,

thanks for the suggestion - however, I think using environment variables is the real solution. I found a post here which still works perfectly:

Environment variables for config.php

This solves the issue of having a config.php with usernames & passwords in some code repository...

Cheers,
B.
The topic has been locked.
  • bdeprez
  • bdeprez's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
7 years 3 months ago #146102 by bdeprez
Replied by bdeprez on topic Deployment on OpenShift
Hi all,

wanted to give you an update and clarify a small caveat with using environment variables.

Environment variables work perfectly on OpenShift BUT (yes, there's a bit "but") it will fail miserably the very first time.

Let me explain:

When you build your container with an existing config.php, the install script connects to the database but then fails since there are no tables in it. So I assume that the install script creates the config.php AFTER it populated the tables in the database.
However, if the LimeSurvey tables already exist, the installer script has no issues and neatly continues.

So, from an Openshift perspective, as long as you have a persistent volume with the LimeSurvey database, you can freely scale your pods up and down, it will work.

Workaround (in case anybody ever comes to this forum looking for a solution):
- create your Openshift builds with the config.php
- when you run your first pod, use the terminal to access your pod
- rename config.php to for example config.php.old
- access the installer
- walk through the complete installer (keeping in mind to use the same variables as you put in your environment variables) till you reach the admin screen
- go back to your pod terminal
- remove the config.php
- rename config.php.old to config.php

Lesson learned - hope this helps anybody in the future!
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 3 months ago #146105 by DenisChenu
Replied by DenisChenu on topic Deployment on OpenShift
Hi,

Reading manual : manual.limesurvey.org/Installation_using...(CLI)#Pre-requisites

Have a config.php without DB must work. Maybe i made an error (don't use such system currently). If you can do some test : maybe you can report bug :)

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
  • bdeprez
  • bdeprez's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
7 years 3 months ago - 7 years 3 months ago #146113 by bdeprez
Replied by bdeprez on topic Deployment on OpenShift
Hi Denis,

thanks for the responses - note that there is no 'bug', it's just the requirements of the company I work at.
Allow me to give a bit of background.
Where I work, we intend to implement LimeSurvey. The platform we have chosen to run this on is Openshift.
With OpenShift, you need to have a codebase which can be pulled from a git and it gets deployed automatically in a pod (like a container in Docker). When the resources of that pod are used up, Openshift creates an additional pod and loadbalances the traffic going to the both pods.
So, we needed to devise a plan to have this code deployed and able to run without manual intervention. The CLI solution would only work for the 1st pod - the second one would then default to the installer screen...
And as it's not allowed to keep 'username / password' combinations hardcoded in a code repository, I had to use 'environment variables'.

So I solved it as described in my previous post.

Hope this clarifies...
Cheers,
B.

ps. If anybody would like to see the template I used on Openshift, happy to share!
Last edit: 7 years 3 months ago by bdeprez.
The topic has been locked.
More
5 years 4 months ago #177436 by waydenie
Replied by waydenie on topic Deployment on OpenShift
Hi,

Is your template offer still open? I'd like to take a look at it if possible?


Thanks!
The topic has been locked.
  • bdeprez
  • bdeprez's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
5 years 3 months ago #177665 by bdeprez
Replied by bdeprez on topic Deployment on OpenShift
Hi waydenie,

I'm intending to do a quick write up of my adventures with getting Limesurvey running on Openshift. We are still on 2.x version (we're not ready to move to 3.x because of the support of IE 11 in version 3 being discontinued and we don't have Edge yet) but the principles would, I assume, all be still very much applicable.

So I'll be back soon...
B.
The following user(s) said Thank You: waydenie
The topic has been locked.
  • bdeprez
  • bdeprez's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
5 years 3 months ago #177675 by bdeprez
Replied by bdeprez on topic Deployment on OpenShift
As promised, a write-up of my experience...

There are a few significant differences between running LimeSurvey on a regular server versus running it on Openshift.
This write-up assumes you know the basic concepts of Openshift such as S2I, Persistent Volumes, ConfigMaps, Build and Deploy configurations, etc. If you don't, please read up on that first.

In this post I'm going to share some of my experiences as well as the roadblocks I faced and how we eventually solved them.

Before I begin, a bit of background on what components we use:
- LimeSurvey php code is stored in a git repository
- For the front end we use the latest Red Hat Software Collection Library (RHSCL) PHP 7.0 S2I image (for detatils see: github.com/sclorg/s2i-php-container )
- For the database we use the latest RHSCL MariaDB 10 image (for details see: github.com/sclorg/mariadb-container )
- Persistent Volumes for the "upload" directory and the database
- Liveness and readiness probes on both the webserver and the database

There were also a few additional requirements / restrictions applicable to Openshift in our company we had to think about:
- we have no access to any command line (either via the web console or via oc rsh) in UAT and PROD
- an applicaiton deployed on Openshift must come up in UAT and PROD without human intervention aside from pushing the 'promote' button which pushes it from INT to UAT and from UAT to PROD.
- in case of major disaster (eg full loss of the entire Openshift estate) one must be able to recover through the same initial deployment process and, where necessary, the restoration of the data in the persistent volumes from backup - no other manual intervention is allowed

So, this is how we achieved that:

1° created a number of secrets (for database usernames and passwords) which are then converted into environment variables in the respective pods

2° created a number of configmaps to contain the variables like database name, port, etc - these are then converted to environment variables as well

3° "config.php" is part of our git and refers to the environment variables created in 1° and 2° (see file in attached zip)

4° create a persistent volume for the "upload" directory and mount it in the pod instead of the real upload directory

5° added a command to the "run" script (see 7°) to populate the persistent volume created in 4° with the standard content of the upload directory (because, different from Docker, when you link storage in Openshift the original content of that directory is discarded so when the container starts the first time you need to pull it again from somewhere else - see 6° and 7°)

6° to achieve 5°, our git contains an additional directory "uploadsource" which is an exact copy of the original "upload" directory

7° the git repository contains a directory ".s2i" with a directory "bin" which contains the "run" script (see file in attached zip) - this then replaces the standard run script which is included in the S2I image. Line 57 contains the command mentioned in 5° (note: do not use this file! It contains other changes we needed to adapt a number of settings in the php.ini - If you need the command copy that line over to your "run" file - if you don't have the original you can pull it from the github mentioned earlier)

8° added "'updatable' => false," in the config.php file - this prevents that message "there's a new version of LimeSurvey" - because an update can't be done on the fly on Openshift we wanted this message to be removed permanently

9° Now, before you can bring up your application pods, you need to create the database. For this, we ran the standard install process on a development box (not openshift) and then exported the required mysql statements needed to populate the database. We then connected to the respective database route and executed that mysql, creating a blank LimeSurvey database. Only then would we bring up the PHP pods.

Our complete deploy config contains more things such as certificates for LDAP, custom HTTPD, php.ini and LDAP configs though I have removed these details to not confuse things too much.

I think that's about it... I'm attaching a zip file with the deploy config, the S2I run file and the config.php.

I hope this is helpful - any questions, let me know... (I'll try to respond asap)

B.
The following user(s) said Thank You: garywong-bc, waydenie, digitday
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 3 months ago #177679 by holch
Replied by holch on topic Deployment on OpenShift

we're not ready to move to 3.x because of the support of IE 11 in version 3 being discontinued and we don't have Edge yet

You can literally use any other modern browser to use the back end of Limesurvey. No need to have Edge installed. But I assume your organisation does not allow other browser than those from MS?

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The topic has been locked.
More
5 years 2 months ago #179016 by garywong-bc
Replied by garywong-bc on topic Deployment on OpenShift
thanks.. FYI (and not that I'm complaining) there's a syntax error in deploy_config.json. Line 452 should be deleted (I suspect in removing the irrelevant details, the matching curly brackets got messed up).
The topic has been locked.
More
5 years 2 months ago #179568 by garywong-bc
Replied by garywong-bc on topic Deployment on OpenShift
Thanks to help from bdeprez I have a 'simpler' version of deployment of LimeSurvey to Openshift 3.x.

It doesn't require s2i, as I just wanted to use the upstream LimeSurvey code repo, and just configure the deployment. If anyone is interested, it's at:
github.com/garywong-bc/nrm-survey

HTH
gary
The following user(s) said Thank You: DenisChenu
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose