We were setting up our own instance of BrowserCMS and it took a few steps to get it up and running. In this post I’m going to recap the steps needed to do this:
Install the basics first
First, get everything up to date first
Next, install rvm to manage the Ruby gems and the active environment
The output will tell you that you need to install a few things. You can copy and run the line that lists the packages required for Ruby.
apt-get install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion
Install a few other things including git, patch, Ruby and Rails.
sudo apt-get install git
sudo apt-get install patch
rvm install 1.9.3
apt-get install rails
Installing the browsercms gems installs all the dependent gems as well
gem install browsercms
I got an error related to building the mysql2 gem. Don’t worry, you just need to install a couple other gems. More info on this here
sudo apt-get install libmysql-ruby
sudo apt-get install libmysqlclient-dev
At this point you’ve installed everything. All that’s left is to create a new instance.
Create a new BrowserCMS instance
Before you do anything, make sure to set your environment’s RAILS_ENV property. I set this in the ~/.bashrc but it may be different for you. Check where you set your env properties in your home folder
should reveal it. Then be sure to reload the profile or exit and log back into the shell so the env setting takes place.
Here we set it to the development environment.
Next, we want to create the instance and tell it do install it on mysql. Default would be sqlite.
bcms new apidocs -d mysql
To be sure you've installed everything, let's run
bundle install in the newly created app.
Lastly, we want to seed the database with the tables and seed data. This can be done in one command with
rake db:install but I prefer to run each of the three commands that get called by
rake db:install, separately. That way if an error occurs I know exactly which one caused it. And in this case, there was an error. First the commands that you run:
When I ran
rake db:seeds with my RAILS_ENV=production, I got an error of:
private method `rand' called for #
This is because for the production env it is creating a random password and for some reason the rand function on Array is private. Whatever. An easy workaround is I just edited
db/browsercms.seeds.rb and added production to the list of checks (line4). This allows db:seeds to run and then you can update the cmsadmin password via the app later
You can re-run db:seeds to finish the db:install
and you should see your server up and running on port 3000. Put in /cms and you can get to the cms administration portion with your login of cmsadmin / cmsadmin.