Somewhat successful vps deployment via install-site.sh

47 views
Skip to first unread message

Alex Popescu

unread,
Aug 19, 2021, 4:54:29 PM8/19/21
to Alaveteli Dev
I stumbled a bit (quite a bit) until I managed [1] to have a running deployment. 
To potentially save some time for future newcomers, seeing that the documentation is somewhat outdated, I'll list here my steps along with some hurdles I ran into and some corresponding questions.

1. started from fresh fresh Ubuntu 18.04  *docs need to be updated, the Debian Wheezy 64-bit or Ubuntu Trusty - 14.04 are outdated.
updated packages:
sudo apt upgrade
*not sure this is a necessary step, I previously had bundle error [2] and later updating the packages might've helped? 

2. added my domain to hosts,
both on the VPS and my local machine
*to be found  /etc/hosts for Ubuntu, Debian, MacOS 

3. downloaded & ran the install script:
> curl -O https://raw.githubusercontent.com/mysociety/commonlib/master/bin/install-site.sh
> sudo sh install-site.sh alaveteli alaveteli-usr alaveteli.myfoia.org

4. set the password for the newly created user
>  sudo passwd alaveteli-usr
then switched to it: 
>  su alaveteli-usr

5. in the Alaveteli folder (/var/www/alaveteli.myfoia.org/alaveteli) ran:
> bundle pristine 

6. created the production database – as suggested here
>  RAILS_ENV=production bin/rake db:create db:migrate db:seed
then 
> script/rails-post-deploy

7. launched Alaveteli:
> service alaveteli start 
interestingly, each time I touch the alaveteli service as the alaveteli user I get prompted for the user initially used to run the installation script

8. by this time I had a running app with no styling - some assets, styles and javascript not found – guess they didn't get compiled and moved in the alaveteli/public folder.
Also ran bundle exec rake themes:install but that didn't help by itself.
bundle exec rake assets:precompile – copies some images into alaveteli/public/assets but not the css/js
I sloppily fixed this by stealing the compiled css & js from a Vagrant install.

9. Creating the admin user.
following Create an admin account I created then confirmed via email (I used mailinator.com to make sure the message doesn't get rejected) and proceeded to /admin?emergency=1 where I logged in with the  emergency user,
see: ADMIN_USERNAME / ADMIN_PASSWORD found in alaveteli/config/general.yml

Then  I ran into this issue: I could edit the new user, but the admin checkbox was disabled. After this step, the emergency user gets disabled, so I got stuck – I eventually managed to elevate my newly created user to admin by editing the users_roles table, as described here.

--------

Are all the above steps necessary, or it's just that the install script failed some tasks?

I saved some logs doing the installation steps:

--------

The installation script page states:
> This is not suitable for production (it runs in development mode, for example) but should set up a functional installation of the site, which can send and receive email.
* even-though the install script uses alavateli_production database 

Does this relate to some configuration items that need changed before going into production, or the install-sh way is not generally suitable for production, the suggested way being the manual install?

thank you,
alex

_____________
[1] with the kind help of Andrei which was familiar with an old version of Alaveteli. 
[2] 
/usr/bin/bundle: bundle: line 5: syntax error near unexpected token `"INT"' /usr/bin/bundle: bundle: line 5: `Signal.trap("INT") do'

Alex Popescu

unread,
Aug 20, 2021, 4:34:53 AM8/20/21
to Alaveteli Dev
update on the setting the first admin user in cases where the emergency user might not be available (with help from Graeme).

launch the Rails Console:
 bundle exec rails console production|test|development 
*the install-sh script sets the default mode to `production
Then in the console:
 User.find_by(email: 'y...@example.com').add_role(:admin)

Gareth Rees

unread,
Aug 20, 2021, 6:09:03 AM8/20/21
to Alaveteli Dev
Hey Alex,

Thanks for all these notes – they'll really help others who run in to similar issues and help us improve the situation in the future. We appreciate it's been a bit frustrating, but the reality is that we're a tiny team with limited funding. It's not possible for us to make everything as slick and easy as we'd obviously like it to be, and we're always really grateful for this kind of documentation that makes it easier to pinpoint pain areas.

Couple of quick notes on some of the specific questions raised:

> sudo apt upgrade *not sure this is a necessary step

I think we've just assumed that your system will be up to date before you start since that's pretty typical good practice.

> each time I touch the alaveteli service as the alaveteli user I get prompted for the user initially used to run the installation script

Not quite sure what you mean here – could you paste some output?

> Also ran bundle exec rake themes:install but that didn't help by itself.

The default theme is the relatively unstyled "none" theme [1]. The idea is that you add your theme on top of this by adding it to THEME_URLS and then run themes:install. Perhaps that was the problem here?

> Does this relate to some configuration items that need changed before going into production, or the install-sh way is not generally suitable for production, the suggested way being the manual install?

I think the most reliable way to install Alaveteli is through the manual install steps, but if you're familiar with Alaveteli then the install script can be used, but it's not a compete solution. It doesn't configure DNS nor does it tune the Alaveteli-specific configuration for running a real production install. It does use Rails' production mode yes, but that's more about Rails' performance tuning. I think the intention of the install script was mainly to set up a demo Alaveteli to be able to get a general feel for the software.

Best,

Gareth

Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted

Alexandru Popescu

unread,
Aug 23, 2021, 5:56:54 AM8/23/21
to alavet...@googlegroups.com
thank you

> On Friday, 20 August 2021 at 13:09:03 UTC+3 Gareth Rees wrote:
>> each time I touch the alaveteli service as the alaveteli user I get prompted for the user initially used to run the installation script

> Not quite sure what you mean here – could you paste some output?

Sorry, I was ambiguous. I meant, each time I tried to start / stop alaveteli service. https://imgur.com/a/DsUT9I6
 
>> Also ran bundle exec rake themes:install but that didn't help by itself.
> The default theme is the relatively unstyled "none" theme [1]. The idea is that you add your theme on top of this by adding it to THEME_URLS and then run themes:install. Perhaps that was the problem here?

As in the link, I had the alavetelitheme selected both on Vagrant and with the install script. While in Vagrant it looked all right, on vps it wouldn't copy the  styles / js to alaveteli/public
I also tried now whatdotheyknow-theme but that results in a HTTP500 error - see the production.log: https://drive.google.com/file/d/1OvAMAEpqGqUAj4OdqC1hdk-jccwCh1_w/view?usp=sharing
My fix at the moment was to install & bundle exec rake assets:precompile the  whatdotheyknow-theme then choose alavetelitheme in general.yml – which doesn't cause an error and plays nice with the whatdotheyknow compiled assets.


PS. Hopefully this time it works, I tried posting this reply 4 times starting last week and each it got deleted
Screenshot 2021-08-23 at 10.55.41.png

--
You received this message because you are subscribed to a topic in the Google Groups "Alaveteli Dev" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/alaveteli-dev/cyqVxVwbFPU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to alaveteli-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/alaveteli-dev/aa962589-846d-435e-a268-f8c216f2c154n%40googlegroups.com.

Gareth Rees

unread,
Aug 23, 2021, 6:08:05 AM8/23/21
to Alaveteli Dev
> Sorry, I was ambiguous. I meant, each time I tried to start / stop alaveteli service. https://imgur.com/a/DsUT9I6

Oh, I see what you mean! Yes, that's correct. Usually I'd use `sudo service…`, but unix permissions are a bit outside the scope of our support here.

> As in the link, I had the alavetelitheme selected both on Vagrant and with the install script. While in Vagrant it looked all right, on vps it wouldn't copy the  styles / js to alaveteli/public

After each code update on the server you should run `script/rails-post-deploy` to run the deployment tasks https://alaveteli.org/docs/running/upgrading/#manual-upgrade

>  also tried now whatdotheyknow-theme

We have some custom behaviour and configuration so we wouldn't recommend this.

> PS. Hopefully this time it works, I tried posting this reply 4 times starting last week and each it got deleted

Sorry about this; Google Groups isn't great.
Reply all
Reply to author
Forward
0 new messages