Skip to content

Adds documentation for manual installation on Ubuntu LTS 16.04#2887

Merged
mrcasals merged 10 commits intomasterfrom
docs/manual-installation
May 8, 2018
Merged

Adds documentation for manual installation on Ubuntu LTS 16.04#2887
mrcasals merged 10 commits intomasterfrom
docs/manual-installation

Conversation

@andreslucena
Copy link
Copy Markdown
Member

Instructions for:

  • rbenv
  • PostgreSQL
  • git
  • figaro

🎩 What? Why?

There are some newcommers to the project that don't understand that well the manual installation instructions. This tries to fix that and also show some good practices on Ruby on Rails development (ie using git, figaro, etc).

📌 Related Issues

None

📋 Subtasks

None

📷 Screenshots (optional)

None

Instructions for:
* rbenv
* PostgreSQL
* git
* figaro
@ghost ghost assigned andreslucena Mar 2, 2018
@ghost ghost added the in-progress label Mar 2, 2018
git commit -m "Adds figaro configuration management"
```

### Initializing your app for local development
Copy link
Copy Markdown
Member Author

@andreslucena andreslucena Mar 2, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe here we should link to this section on getting started, so we don't duplicate the text, but the idea here was to be able to explain more what and where exactly you can log in and what can do every user.


## Step by step

We're starting with an Ubuntu 16.04 LTS. This is an opinionated guy and YMMV, so if you're free to use the technology that you fell most comfortable on. If you have any doubts and you're blocked you can go and ask on [our Gitter](https://gitter.im/decidim/decidim). We recommend that you follow some Ruby on Rails tutorials (like [Getting Started with Ruby on Rails](http://guides.rubyonrails.org/getting_started.html)) and have some knowledge on how gems and engines work.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/guy/guide/?


```bash
git init .
git commit -m "Initial commit. Generated with Decidim 0.X https://decidim.org"
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add something like "Where Decidim 0.X is your Decidim version (see your Gemfile)"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can add this to the generator, it's cool! :)

@mrcasals
Copy link
Copy Markdown
Contributor

mrcasals commented Mar 2, 2018

I feel like we should direct the newcomers to some other official guide on how to setup their environment, outside our repo, instead of offering the guide ourselves. Otherwise we'll end up adding guides on how to install the environment in Mac & Windows too, and we'll have to keep them up to date.

Also, what is figaro and why is it needed to start developing with Decidim? I certainly have never used it 😕

```bash
decidim decidim_application
cd decidim_application
bundle install
Copy link
Copy Markdown
Contributor

@deivid-rodriguez deivid-rodriguez Mar 2, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think our generator automatically runs bundle install on the generated application.


```bash
git add .
git commit -m "Adds figaro configuration management"
Copy link
Copy Markdown
Contributor

@deivid-rodriguez deivid-rodriguez Mar 2, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Modern rails provide encrypted secrets out of the box now, maybe we should explore that so these tweaks are not necessary.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I forgot that was the Rails official way now. I've really didn't use it yet, the idea here was only to show the gist of handling secrets. I'll add a comment and link on a guide on using/handling the secrets.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added the comment regarding secrets. As I said, I didn't try it (yet), although I've read that on 5.1 was secrets and now on 5.2 is call credentials, so I think it's still moving. After I try and test it on staging/production I'll update this.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@deivid-rodriguez we use rails-secrets and figaro in our projects but we use them differently, maybe we're doing it the wrong way:

  • rails-secrets only for data that can go to version control
  • figaro for data that can not be checked into version control.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure, the idea in modern rails versions in that everything is checked into version control, but secret data is commited encrypted.

Now we're going to install PostgreSQL for the database:

```bash
sudo apt-get install -y postgresql libpq-dev
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If libpq-dev is not installed, the previous bundle install will fail so probably this step should be before the generation of the application...

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can do this with a oneliner :)

sudo -u postgres psql -c "CREATE USER decidim_app WITH SUPERUSER CREATEDB NOCREATEROLE PASSWORD 'decidim_app'"

Not that I used NOCREATEROLE because the DB user does not need role creation privileges.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, great feedback, I'll change it

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If libpq-dev is not installed, the previous bundle install will fail so probably this step should be before the generation of the application...

I've moved the postgres installation so it's before decidim installation

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can do this with a oneliner :)

Changed it!

@deivid-rodriguez
Copy link
Copy Markdown
Contributor

I kind of share a similar feeling to @mrcasals as to where these docs should live, but if @andreslucena is committed to maintaining these docs up to date, it could be a useful resource for newcomers...

@andreslucena
Copy link
Copy Markdown
Member Author

Regarding figaro, it's just an example on how to handle secrets. I'll add other proposed alternatives, just so it's clear that it could be done on others ways.

Regarding if we should/shouldn't have this kind of documentation, please see https://consul_docs.gitbooks.io/docs/content/en/getting_started/prerequisites/linux.html - also check all the manual, I think it's much better and with much detail documentation than ours.

@xabier
Copy link
Copy Markdown

xabier commented Mar 20, 2018

@mrcasals

I feel like we should direct the newcomers to some other official guide on how to setup their environment, outside our repo, instead of offering the guide ourselves. Otherwise we'll end up adding guides on how to install the environment in Mac & Windows too, and we'll have to keep them up to date.

It is very important for the democratic nature of the project to make it easy to install on GNU/Linux (not so much on Mac or Win, not really that many servers running win or mac). And I think it is very convenient to have the instructions included here, particularly if they are just a couple of command line options (or 7 for the same matter). We should hope for something like this: https://github.com/discourse/discourse/blob/master/docs/INSTALL-cloud.md

I know many organizations with competent admin who could not install Decidim. The more help we provide and clearer instructions the better. Not all environment installs work equal, and it is good to provide the way it works.

@deivid-rodriguez
Copy link
Copy Markdown
Contributor

@xabier I agree that we need better setup/deployment docs, but I think @mrcasals had a good point here. If your read the patch, these are not 7 commands, but a recipe that can get quite complex, get outdated or change over time.

In my opinion discourse is indeed a fantastic model to follow because it satisfies both concerns:

  • It has nice, concise and clear setup instructions.
  • It uses a docker image so setting up ruby, postgresql and other global dependencies is completely transparent to the user since it's included in the image. And it works on any platform, so we won't need any platform specific stuff.

@josepjaume's input is very valuable here since I suspect he knows a lot about deploying docker images :)

@andreslucena
Copy link
Copy Markdown
Member Author

@deivid-rodriguez I'm with you regarding that we should have something similar to what Discourse offers (or something that at least doesn't have that much steps as the instructions on this PR). Also this is going to be needed for another kind of applications that we want to integrate to (ie see #3166 )

This PR is only a set of instructions that wants to bridge the gap of what @xabier said:

I know many organizations with competent admin who could not install Decidim.

@mrcasals
Copy link
Copy Markdown
Contributor

I don't use Ubuntu, so I can't commit to keep this updated, that's why I still think that all the part on how to install Ruby should be delegated to somewhere else... Maybe pointing to the rbenv/rvm docs page could be enough.

…id-rodriguez

* Change typo on guy/guide
* PostgreSQL installation before installing Decidim 
* Removing bundle install on Decidim installation 
* Adds sekrets/encrypted secrets mention on secrets handling 
* Change postgreSQL database/user creation
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 12, 2018

Codecov Report

❗ No coverage uploaded for pull request base (master@a65219f). Click here to learn what that means.
The diff coverage is n/a.

@@            Coverage Diff            @@
##             master    #2887   +/-   ##
=========================================
  Coverage          ?   98.72%           
=========================================
  Files             ?     1651           
  Lines             ?    39195           
  Branches          ?        0           
=========================================
  Hits              ?    38697           
  Misses            ?      498           
  Partials          ?        0

@andreslucena
Copy link
Copy Markdown
Member Author

I don't use Ubuntu, so I can't commit to keep this updated, that's why I still think that all the part on how to install Ruby should be delegated to somewhere else... Maybe pointing to the rbenv/rvm docs page could be enough.

The general idea of this guide is about downgrading the knowledge to at least install Decidim locally, by an Ubuntu sysadmin/user. I think the full instructions is important, although I also added a mention to RVM as an alternative.

@andreslucena
Copy link
Copy Markdown
Member Author

In my opinion discourse is indeed a fantastic model to follow because it satisfies both concerns

Yes, we have that on the roadmap, this is just a quick patch on the doc side until we have something working on this area.

Discourse model seems like a good candidate for this problem, although there are some important differences with what Decidim is at the moment: for instance, Discourse is a full blown app (ie you can modify CSS/HTML/JS through the admin panel) and Decidim is a framework where you work directly with the Ruby on Rails application. Maybe the decidim-launcher would also need to point to a generated app?

We hope to talk about this (Decidim installation/development/deployment flows) on the near future.

@andreslucena
Copy link
Copy Markdown
Member Author

I think that all the doubts/changes that were discussed are already responded or changed. @deivid-rodriguez @mrcasals could you say something and merge (or give more feedback)? Thanks!

Copy link
Copy Markdown
Contributor

@deivid-rodriguez deivid-rodriguez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@andreslucena I left some more feedback but it looks almost ready to me! I'm still afraid this will get outdated and get misleading instead of useful but I'm happy to be proven wrong!

gem install decidim
```

Afterwards, we can create an application with the nice `decidim` executable, where `decidim_application` is your application name (ie DecidimBarcelona):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Camelizing is a bit weird here I think, maybe decidim.barcelona is better.

rbenv global 2.5.0
echo "gem: --no-document" > ~/.gemrc
gem install bundler
```
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This still looks too specific to me... For example, it's already outdated and it's now recommending an potentially insecure ruby version without all the latest security patches (2.5.1 is out).

I would probably remove these instructions and mention that you need an up to date ruby and point out to official docs on installing it (or maybe even to our docker image).

But if we want to keep it in the repo we need to commit to keeping it up to date, so we should get that version updated.

@ghost ghost assigned tramuntanal May 2, 2018
@tramuntanal tramuntanal removed their assignment May 3, 2018
@andreslucena
Copy link
Copy Markdown
Member Author

@deivid-rodriguez I agree with all your comments regarding the short live of this doc, specially regarding software versions, ie Ubuntu LTS now is 18.04 😅

We hope to have a better installation/deployment method with @gmarpons - probably something based on Discourse scripts or something like that. If you know any other RoR open source projects that have a nice installation/deploy method that'd be awesome.

Copy link
Copy Markdown
Contributor

@deivid-rodriguez deivid-rodriguez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, let's add this an iterate on better solutions later!

@mrcasals mrcasals merged commit f8c7302 into master May 8, 2018
@ghost ghost removed the status: WIP label May 8, 2018
@mrcasals mrcasals deleted the docs/manual-installation branch May 8, 2018 07:12
isaacmg410 pushed a commit to CodiTramuntana/decidim that referenced this pull request May 25, 2018
…im#2887)

* Adds documentation for manual installation on Ubuntu LTS 16.04.

Instructions for:
* rbenv
* PostgreSQL
* git
* figaro

* Update manual installation doc with feedback from @mrcasals and @deivid-rodriguez 

* Change typo on guy/guide
* PostgreSQL installation before installing Decidim 
* Removing bundle install on Decidim installation 
* Adds sekrets/encrypted secrets mention on secrets handling 
* Change postgreSQL database/user creation

* Removing trailing white space

* Adding servers/technologies on manual installation

* Markdown format: Adds language to fenced code block

* Adds mention to rvm

* Remove white trailing space :/

* Changes details with feedback from @deivid-rodriguez
@Digharatta
Copy link
Copy Markdown
Contributor

Thank you very much for the guide. With the help of it, plus GoRails guide and ImageMagick guide I finally managed to launch a first shaky Ukrainian deployment.

On one hand, GoRails guide is indispensable, since it gives precise, updated, and version-sensitive instructions. On the other hand, I needed PostgreSQL instructions from your guide, since they are app-specific. GoRails PostgreSQL instructions weren't suitable.

IMHO some parts of the guide can be outsourced, with links to appropriate resources, e.g.:


Install Ruby, NodeJS and Nginx

As described at (URLs)

Install PostgreSQL

sudo apt-get install -y postgresql libpq-dev
sudo -u postgres psql -c "CREATE USER decidim_app WITH SUPERUSER CREATEDB NOCREATEROLE PASSWORD 'thepassword'"

etc.

Install ImageMagick

As described at (URLs)

Install Decidim
gem install decidim etc.

Configure Nginx and hide the secrets

As described at (URLs).


IMHO, local setup guide and deployment guide should be separate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants