decidim-docs

Installing decidim on ubuntu 18.04

Initial setup: automating-initial-server-setup-with-ubuntu-18-04 (without setting firewall)

sudo apt-get update  
sudo apt-get upgrade

Installing Ruby

https://gorails.com/setup/ubuntu/18.04

curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list

sudo apt-get update
sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev software-properties-common libffi-dev nodejs yarn

cd
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
exec $SHELL

git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc
exec $SHELL

rbenv install 2.5.1
rbenv global 2.5.1
ruby -v
echo "gem: --no-document" > ~/.gemrc
gem install bundler
rbenv rehash

git

git config --global color.ui true
git config --global user.name "YOUR NAME"
git config --global user.email "YOUR@EMAIL.com"
ssh-keygen -t rsa -b 4096 -C "YOUR@EMAIL.com"

The next step is to take the newly generated SSH key and add it to your Github account. You want to copy and paste the output of the following command and paste it here.

cat ~/.ssh/id_rsa.pub

Once you’ve done this, you can check and see if it worked:

ssh -T git@github.com

You should get a message like this:

Hi excid3! You've successfully authenticated, but GitHub does not provide shell access.

Installing Rails

curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs
gem install rails -v 5.2.0
rbenv rehash
rails -v

Installing Postgresql

sudo sh -c "echo 'deb http://apt.postgresql.org/pub/repos/apt/ xenial-pgdg main' > /etc/apt/sources.list.d/pgdg.list"
wget --quiet -O - http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get install postgresql-common
sudo apt-get install postgresql-9.5 libpq-dev

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

Installing Nginx & Passenger

https://www.phusionpassenger.com/library/install/nginx/install/oss/bionic/

sudo apt-get install -y dirmngr gnupg
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 561F9B9CAC40B2F7
sudo apt-get install -y apt-transport-https ca-certificates

sudo sh -c 'echo deb https://oss-binaries.phusionpassenger.com/apt/passenger bionic main > /etc/apt/sources.list.d/passenger.list'
sudo apt-get update

sudo apt-get install -y libnginx-mod-http-passenger

if [ ! -f /etc/nginx/modules-enabled/50-mod-http-passenger.conf ]; then sudo ln -s /usr/share/nginx/modules-available/mod-http-passenger.load /etc/nginx/modules-enabled/50-mod-http-passenger.conf ; fi
sudo ls /etc/nginx/conf.d/mod-http-passenger.conf
sudo service nginx restart

sudo /usr/bin/passenger-config validate-install

Installing Imagemagick

sudo apt-get install checkinstall
sudo apt-get build-dep imagemagick -y

sudo wget http://www.imagemagick.org/download/ImageMagick.tar.gz
sudo tar xzvf ImageMagick.tar.gz

cd ImageMagick-7.****
sudo ./configure
sudo make clean
sudo make
sudo checkinstall
sudo ldconfig /usr/local/lib

Installing Decidim

cd
gem install decidim
decidim decidim_application
cd decidim_application
echo "gem 'figaro'" >> Gemfile
bundle install
bundle exec figaro install

cat <<EOF > config/application.yml
DATABASE_HOST: localhost
DATABASE_USERNAME: <database_username>
DATABASE_PASSWORD: <database_password>
EOF

bin/rails db:create db:migrate db:seed

SEED=true rails db:setup

Deploying decicim

add this line:
adapter: postgresql
to the production section of the config/database.yml file

create your System user in your production Ruby on Rails console bin/rails c:

email = "<your email>"
password = "<a secure password>"
user = Decidim::System::Admin.new(email: email, password: password, password_confirmation: password)
user.save!

visit the /system dashboard and login with the email and passwords you just entered and create your organization.

nginx config for deployment

https://www.phusionpassenger.com/library/deploy/nginx/deploy/ruby/#deploying-an-app-to-a-virtual-host-s-root