Primero production setup issue

Hello I have been trying to install production setup for Primero as specified in this link (https://github.com/primeroIMS/primero/tree/maint_1.6/cookbook) but every time I get an error during ruby-bundle-install even after following all the steps mentioned. I have even followed steps mentioned in this link (How can I quickly set up Primero) but yet I am getting the same error. Please refer the attached screenshot of the same.
Please provide some pointers to move forward. Thanks in advance.

What do you have for this part in your .json deploy file?

"primero": {
    "environment": "dev",
    "rails_env": "production",
    "server_hostname": "somehost.com",
    "no_reseed": false,
    "git": {
      "repo": "<your git repo>",
      "revision": "maint_1.6"
    },

particularly the repo and revision parts

Thanks for your reply @irlawrence this is how my .json deploy file looks like.
“primero”: {
“environment”: “integration”,
“rails_env”: “production”,
“server_hostname”: “somehost.com”,
“no_reseed”: false,
“git”: {
“repo”: “https://github.com/primeroIMS/primero.git”,
“revision”: “master”
},

There is no master branch on the repo, Change that to

“primero”: {
“environment”: “integration”,
“rails_env”: “production”,
“server_hostname”: “somehost.com”,
“no_reseed”: false,
“git”: {
“repo”: “https://github.com/primeroIMS/primero.git”,
“revision”: “maint_1.6”
},

and try running it again. You may need to wipe the deploy server first as well

Thanks for the reply @irlawrence.
When I change my revision to ‘maint_1.6’ and when I again try to deploy then it asks for a password during [ruby-bundle-install] this is how I get
‘Enter your password to install the bundled RubyGems to your system’
Although when I specify the password of the server machine then the installation stalls and after some time I get an error saying ‘Mixlib::ShellOut::CommandTimeOut’.
Please refer the attached screenshot.


Please provide me with some pointers to move ahead.
Also do I need to install anything else except for the ones specified in the following links
(How can I quickly set up Primero) or (https://github.com/primeroIMS/primero/tree/maint_1.6/cookbook)

No, the How can I quickly set up Primero link has everything you need.
You have installed Ubuntu 16.04 LTS on the deploy server, right?

You could try ssh’ing into the target machine and removing rvm completely like

sudo -Hu primero bash
source ~/.rvm/scripts/rvm
cd ~/application
rvm implode

Thanks for the reply @irlawrence.
Yes I have ubuntu 16.04 on the target machine and I carried all the steps you mentioned above but yet it is asking for password during [ruby-bundle -install].
I have created a passwordless sudo user on the target machine as mentioned here How can I quickly set up Primero and after entering the password it stalls and I get this “Mixlib::ShellOut::CommandTimeOut” error almost after 1 hour.
Why is this happening?
Please refer the attached screenshot.


Any kind of help is appreciated.

It should not ask you for a password during the ruby install. It is doing this because it is trying to use the system ruby to install stuff
I suggest blowing away everything on the target machine and starting chef again

Hey thanks for the reply @irlawrence.
I tried everything as mentioned here How can I quickly set up Primero even I copied the ‘ssh id’ into the target machine as mentioned here How can I quickly set up Primero but yet it asks for password during bundle install.
It doesn’t ask for password when I ssh into the target machine but it asks for password during bundle install and then it stalls over there. Later I get a timeout error. Please provide me with some solution. Thank you.

Hey @irlawrence thanks for your support. Can you please give me some info as why it could be using the system ruby instead of using ruby 2.4.3 railsexpress? Is it because it is not able to download it during deploy?..what wrong could I be doing because I have cleaned my target machine completely, installed ubuntu 16.04 and followed all steps as mentioned here How can I quickly set up Primero.
What could be causing this issue?
Please suggest me with some solution as I am stuck here. Thanks in advance.

Can you make a test and try to install maint_1.7 branch in the json config?

Thanks for the support @irlawrence I changed to maint_1.7 yet the same issue.
I have managed to install production setup somehow.
I changed the line

rvm install #{node[:primero][:ruby_version]} -n #{node[:primero][:ruby_patch]} --patch #{node[:primero][:ruby_patch]}

in cookbook/recipes/application.rb file to

rvm install #{node[:primero][:ruby_version]} -n #{node[:primero][:ruby_patch]}

and it was successful in installing ‘ruby-bundle’. I suppose it was having some issue while installing ruby 2.4.3-railsexpress with that earlier command.

But now when I want to make some changes in the primero logo and some java script files so I changed the logo file i.e logo.png in

/srv/primero/application/app/assets/images

and I added some javascript files in

/srv/primero/application/app/assets/javascripts

And I restarted the nginx service but nothing is getting reflected back.
Also I ran the primeroctl file using primeroctl restart which stops and restarts all the services but yet nothing is getting reflected.
How should I move ahead?

So I tried adding logo and javascript files in to my github repository and I again deployed everything back then now I am getting this error

Error executing action stop on resource 'supervisor_service[who-watches-the-couch-watcher]'

Below is the attached screenshot for the same


Please provide me with some pointers to move ahead. Thanks is advance.

Congratualtions on working out the issue!
Maybe its best to back up a little first. What are you trying to do with Primero? Are you trying to install a production server or are you trying to set up an environment for development?
If you are trying to do development then I would suggest starting to get to know the v2 server. Instructions for that are here.
If you are trying to set up a production server and then customise it a bit the best way to do that is to use rake tasks. Look in the lib/tasks folder for these

Thanks @irlawrence for your reply.
I was actually trying to install the production setup. Thanks for all your help.

Now as I have a running production setup, I want to change the logo and add some javascript files. I some how managed to find the files on the server machine in the /srv/primero/application folder but if I directly replace the files in that folder than my changes are not getting reflected.

Now alternately I even tried adding files to my github repository and ran the deployment process again than it gave me an error (Note: There is a production setup already running on that server). Below is the attached screenshot.

Now what should I do so that my changes (after adding new files) will get reflected in the production setup without again redeploying it? Also how can i tackle this above mentioned error. Thanks in advance

Hey @irlawrence thanks for all the help.

  • If you are trying to set up a production server and then customise it a bit the best way to do that is to use rake tasks. Look in the lib/tasks folder for these *

Yes I checked the ‘rake’ tasks files in the lib/tasks folder but I didn’t really get as what is in those file. If possible could you please throw some light on it? How to use those .rake files?
Thanks in advance.