-
Notifications
You must be signed in to change notification settings - Fork 283
Manual Installation
Operating System: Linux (Debian/Ubuntu recommended)
This document will walk you through all the steps to install OneBody on a Ubuntu Linux server with Apache, MySQL, Ruby, and some other stuff. If you'd rather serve the app with Nginx, you can still follow a lot of the steps here, but also see Serving with Nginx.
First, a word of warning: OneBody is not a PHP app that can be FTP'd to a cheap web host. You will need a dedicated Linux server (or Virtual Private Server) with 1 Gb of memory and root shell access.
If you don't feel comfortable logging into a web server from the console, typing lots of commands, reading the output, Googling error messages, and generally troubleshooting the whole process, then please don't try this. If you don't have an hour to spare, then don't try to rush it, as it will only end in frustration—It would be better for you find a consultant on freelancer.com or oDesk and pay them to do it.
On the other hand, if you're an I.T./sysadmin/hacker with guts, then please proceed!
If you're logged in as the root
user, then everywhere you see sudo
below, you can pretend it's not there (don't type it).
-
Get a Linux server with Ubuntu Linux 14.04 LTS on it. A newer version of Ubuntu will likely work. Debian should work, but extra googling may be required.
If you are using RedHat/CentOS, SuSE or something else "enterprise" worthy, you're kinda on your own.
-
Install all this software first:
sudo apt-get install -y vim build-essential curl \ libreadline-dev libcurl4-openssl-dev \ git mysql-server libmysqlclient-dev \ libaprutil1-dev libapr1-dev \ apache2 apache2-threaded-dev libapache2-mod-xsendfile \ imagemagick
That command is for Debian/Ubuntu; if you're using another Linux distro, you'll need to find and install the same packages (possibly different names) using your distro's package management tool.
On Debian Jessie there is a "nodejs" package, but not on older Debian releases. You may need to install Node.js by following these steps from Joyent.
-
Install Ruby 2.2 or higher. Brightbox has a Ruby package for Ubuntu, which you can install like this:
sudo apt-get install -y software-properties-common sudo apt-add-repository -y ppa:brightbox/ruby-ng sudo apt-get update sudo apt-get install -y ruby2.2 ruby2.2-dev
If you're on Debian, you can follow the instructions here for compiling Ruby from source.
Whatever method you choose, don't move on from this step until you can type
ruby --version
and see "ruby 2.2.0" (or a newer version) in your console. -
Install Node.js:
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash - sudo apt-get install -y nodejs
-
Install Yarn:
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 -y yarn
-
Now, let's get the OneBody source code!
cd /var/www git clone git://github.com/seven1m/onebody.git cd onebody
This will put the latest and greatest, bleeding edge OneBody code in the
/var/www/onebody
directory.Now, it's recommened you switch to a tagged release of OneBody, which you can do with the command
git checkout 3.8.0
. -
Make sure Apache will be able to write tmp files and logs and such:
mkdir -p tmp/pids log public/system chmod -R 777 tmp log public/system chmod -R 777 cache
-
Now, create your database:
mysql -u root -e "create database onebody default character set utf8 default collate utf8_general_ci; grant all on onebody.* to onebody@localhost identified by 'onebody';"
If you get an error about access being denied, then you may need to use
mysql -u root -p -e "..."
and enter your root password.You'll notice we set the username and password to "onebody" and "onebody". That is ok, as long as you: 1) trust all the users logging into this Linux server (or you're the only one), and 2) do not grant access to users outside of localhost (notice the
onebody@localhost
part). If you cannot answer yes to both of those questions, then please change the password to something else (you'll just need to change it also in theconfig/database.yml
file in the next step) and make sure/var/www/onebody
is not accessible to those devious users you let on your server. :-) -
cp config/database.yml{.mysql-example,}
If you used something other than "onebody" for your MySQL password, then change it appropriately in this file using vim or nano or another text editor.
-
Install the bundler gem and then use bundler to install all OneBody gem dependencies:
sudo gem install bundler bundle install --deployment
Do not continue if you get an error saying something could not be downloaded/compiled/installed. There may be other development packages that need to be installed here, like "libxml", so read the errors carefully, install the needed stuff, then come back and run this command again.
-
cp config/secrets.yml{.example,}
then edit theconfig/secrets.yml
file and add a random secret token to the "production" section.(You can use
bundle exec rake secret
to generate a new random secret that you can copy and paste into the secrets.yml file, or just make up something really long and random by smashing your head on the keyboard.) -
RAILS_ENV=production bundle exec rake db:migrate db:seed
Watch the output! Don't move on if you see an error on the screen.
-
Install JavaScript dependencies:
yarn install
-
RAILS_ENV=production bundle exec rake assets:precompile
to prepare all the CSS and JavaScript files.If this step fails complaining about lack of JavaScript runtime, you should make sure you have Node.js installed. You should have installed Node.js above.
-
Add the Passenger APT repository from Phusion (follow directions at that link) and then run:
sudo apt-get update sudo apt-get install libapache2-mod-passenger sudo a2enmod passenger sudo service apache2 restart
Then, to make sure all that worked, run the following command:
apachectl -M
You should see
passenger_module
in the list. If you don't, go back, read the Passenger documentation, and try again. -
Next we need to edit the default vhost (or create a new vhost) and point the
DocumentRoot
to theonebody/public
folder.For Ubuntu/Debian, that looks something like this:
vim /etc/apache2/sites-available/default
orvim /etc/apache2/sites-available/000-default.conf
and change the DocumentRoot to be/var/www/onebody/public
.Next you need to add these two lines to the config:
XSendFile On
andXSendFilePath /var/www/onebody/public/system
. So, to recap, you need to have the following three lines in your Apache vhost (not necessarily right next to each other):DocumentRoot /var/www/onebody/public XSendFile On XSendFilePath /var/www/onebody/public/system
-
Now enable the xsendfile Apache module and restart Apache:
sudo a2enmod xsendfile sudo service apache2 restart
Now, if you did all that right, you probably have OneBody running on your host. You will want to map a domain to your host with DNS, but to test it out, type
http://YOUR_IP_HERE
into a browser.If nothing comes up, you'll need to troubleshoot a few things (not in the scope of this document), such as firewall (iptables), is that the right public IP address, etc. God be with you!
Oh, and a few more things:
-
Pick a path in the Email Setup page to set up incoming and outgoing email.
Incoming and outgoing email is a must for group interaction and person-to-person communication. Also, since signing up as a new user sends an email to admins, sign-up will fail with a big ugly error message for new users until this is complete.
-
Write the user crontab:
RAILS_ENV=production bundle exec whenever -w
This is necessary for a whole lot of things (you can see what it wrote by typing
crontab -l
) such as incoming email, group membership updates, news feed imports, etc. -
Set up DNS on your domain so you can use
members.mychurch.org
instead of111.222.333.444
.You need an
A
record pointing your domain to your IP address. It's pretty simple.You'll also need an MX record for incoming email. See Email Setup for help with that.
Whew! We know that was a lot. If you made it this far, and OneBody is running, then congratulations!
What's next? Complete the form on the initial Setup screen, then head over to the Settings page in the Admin dashboard, and start customizing!
I only see a listing of files when I visit my site.
Passenger isn't installed properly. Go back to steps 12 and 13 and try again. You might need to consult the Passenger install docs for further help.
I cannot upload photos.
You need to create the public/system
, tmp
and log
directories and make sure they are writable:
cd /var/www/onebody
mkdir tmp log public/system
sudo chmod -R 777 tmp log public/system
Also ensure that ImageMagick is installed:
sudo apt-get install imagemagick
When new users try to sign up, they get an ugly error.
You need to set up your email server for outgoing email. Since signing up sends an request email to admins, and you don't have a mail server, Rails freaks out.
This section has been moved to How To Upgrade Manually.