Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Red Hat 7 install #128

Closed
smoebot opened this issue Nov 25, 2016 · 3 comments
Closed

Red Hat 7 install #128

smoebot opened this issue Nov 25, 2016 · 3 comments

Comments

@smoebot
Copy link

smoebot commented Nov 25, 2016

We're restricted to Red Hat 7 here, and we went on a bit of a mission to get it going, here's the steps we followed.

export RAILS_ENV=development

Install prerequisites
From the command line run the following commands
sudo yum update

sudo yum install gcc gcc-c++ make zlib-devel openssl-libs openssl-devel readline-devel libyaml-devel sqlite-devel sqlite libxml2 libxml2-devel libxslt libxslt-devel libcurl-devel libffi-devel ImageMagick-devel ImageMagick redis linux-headers-generic

Install Bandit for python static code analysis (optional). Run the following from the command line
sudo yum install python-devel python-pip

Setup Ruby
Install rbenv
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

Install ruby 2.3.1
rbenv install 2.3.1
rbenv global 2.3.1

Install gems
gem install bundler --no-ri --no-rdoc
gem install sidekiq --no-ri --no-rdoc

Install Rails
curl -sL https://rpm.nodesource.com/setup_6.x | sudo -E bash -
sudo yum install nodejs

gem install rails -v 4.2.6 --no-ri --no-rdoc
rbenv rehash

Install Postgres
Run the following commands
wget http://apt.postgresql.org/pub/repos/yum/InstallPGDGRepoRPM.sh
./InstallPGDGRepoRPM.sh

Follow the instructions to install the temporary repo, then after it is complete, install pacakges
sudo yum update

sudo yum install postgresql95 postgresql95-server postgresql95-libs postgresql95-contrib postgresql95-devel postgresql-devel-9.2.18-1.el7.x86_64

Setup a database user
sudo -i -u postgres createuser scumblr -s

Setup a database password
sudo -u postgres psql
postgres=# \password scumblr

Type '\q' to quit

Get scumblr
Run the following commands:
git clone https://github.com/Netflix/Scumblr.git
cd Scumblr
bundle install

you might have issues executing files from the /tmp directory, I got around it with:
sudo mount -o remount,exec /tmp

then, after you're done with the install
sudo mount -o remount,noexec /tmp

Setup Database
Edit the config/database.yml to point to your database. Example (update to match your username, password, host and database name):

development:
adapter: postgresql
host: localhost
port: 5432
username: scumblr
password: scumblr
database: scumblr_dev
pool: 5
timeout: 5000

Initialize the database
sudo /usr/pgsql-9.5/bin/postgresql95-setup initdb

Start postgresql
sudo service postgresql-9.5 start

Set postgresql to start on boot
chkconfig postgresql-9.5 on

Ensure that postgeresql is in the list of services enabled
systemctl list-unit-files

There may be auth issues (IDENT failure) with getting rake to create the database, if so change the METHOD for the connection being used from 'ident' to 'md5'
sudo nano /var/lib/pgsql/9.5/data/pg_hba.conf

Create the database
rake db:create
rake db:structure:load

Initial Setup
Setup an admin user
rails c

In the console:
user = User.new
user.email = "<Valid email address>"
user.password = "<Password>"
user.password_confirmation = "<Password>"
user.admin = true
user.save

exit the console

Add an iptables rule to allow inbound connections
sudo iptables -I INPUT -p tcp --dport 3000 -j ACCEPT

Start Scumblr
From the command line from the Scumblr root folder:
redis-server & bundle exec sidekiq -l log/sidekiq.log & bundle exec rails s -b 0.0.0.0 &

Now connect to your server on port 3000 (http://localhost:3000 in a browser if running on your local machine).

There you go! Hopefully you have Scumblr running on Red Hat now. If not, then hopefully these steps can help to troubleshoot where it went wrong

@ahoernecke
Copy link
Contributor

Hi @smoebot,

Thanks for taking the time to write these up. I've added a page for these instructions to the wiki!

Thanks again!

@smoebot
Copy link
Author

smoebot commented Dec 6, 2016

no problem, hope it's useful for someone!

I did notice that in the write up, i've made the block about config/database.yml a quote instead of a code block. it doesn't read as well on the wiki.

@ahoernecke
Copy link
Contributor

Good catch, thanks. Fixed!

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

No branches or pull requests

2 participants