Skip to content
juliend2 edited this page Sep 8, 2010 · 7 revisions

On your local machine (for development)

These instructions are for Mac or Linux (not tested on Linux but should work)

  1. First, install shotgun (so you don’t need to restart your rack each time you make a change) : sudo gem install shotgun
  2. Copy config/database.yml.tpl to config/database.yml
  3. Issue a rake db:migrate
  4. Issue a rake db:seed and you should see “You’ve Successfully Loaded your blog’s initial data.” along with your Admin Username and Password.
  5. Issue a shotgun config.ru to start the development server
  6. Login to http://localhost:9393/admin and start entering some fake content for development purpose!

On your own server

(This is the prefered way for deploying a Lennon blog.)

  1. You’ll first need to copy config/database.yml.tpl to config/database.yml and modify the configurations. (replace every occurrence of “development” with “production”)
  2. Issue a rake db:migrate RACK_ENV=production
  3. Issue a rake db:seed RACK_ENV=production and you should see “You’ve Successfully Loaded your blog’s initial data.” along with your Admin Username and Password.
  4. Deploy the app as any other Sinatra-based app. (See: http://sinatra-book.gittr.com/#deployment )
  5. Go to http://<ADDRESS OF YOUR SITE>/admin and login with your infos that you got when you previously ran rake db:seed RACK_ENV=production. Run it again if you don’t remember, it will not override the informations but only show the same result again. By the way, you can safely delete seeds.rb at this point.
  6. Change the configurations (like your password, and blog_url) in the Options section of the admin.

On Dreamhost

  1. In your control panel, go into Domains > Manage Domains > Add New Domain / Sub Domain
  2. Enter the domain in which you want to host your Lennon blog. And make sure you check the " Passenger (Ruby/Python apps only):" option in “Web Options”.
  3. Click “Fully host this domain” (or “Change Settings” if the domain was already created). (Note that it might take a few seconds for the directory to be created in your user directory).
  4. Go into the directory that has been created. And delete the “public” directory that is inside it.
  5. Upload all the files in your lennon directory. At this point you should have your blog files (blog.rb, config, config.ru and so on) directly inside your domainname.com/ directory.
  6. Since the Sinatra gem is not installed on Dreamhost, you’ll need to install it.
    1. First, create a ‘vendor’ directory in your blog directory (same level as config, db, lib and so on). ( mkdir vendor )
    2. go to vendor ( cd vendor )
    3. clone the Sinatra gem into your vendor directory ( git clone http://github.com/sinatra/sinatra.git )
    4. Add this line to your config.ru, right before “require ‘blog’”: require 'vendor/sinatra/lib/sinatra.rb'
  7. copy config/database.yml.tpl to config/database.yml ( cp config/database.yml.tpl config/database.yml ) and open it to change “development” for “production”. DON’T forget to change “db/development.sqlite3” for “db/production.sqlite3” !!!
  8. In the Rakefile, change “db/development.sqlite3” for “db/production.sqlite3”
  9. Issue a rake db:migrate RACK_ENV=production
  10. Issue a rake db:seed RACK_ENV=production and you should see “You’ve Successfully Loaded your blog’s initial data.” along with your Admin Username and Password.
  11. Re-open config.ru and add these two lines directly after “require ‘blog’” :
    1. set :run, false
    2. set :environment, :production
  12. Restart your app by:
    1. Creating a ‘tmp’ folder inside your app ( mkdir tmp )
    2. Issue a touch tmp/restart.txt
  13. Go to http://<ADDRESS OF YOUR SITE> and you should see “A Lennon Blog”. See the next section if it’s not working.
  14. Go to http://<ADDRESS OF YOUR SITE>/admin and login with your infos that you got when you previously ran rake db:seed RACK_ENV=production. Run it again if you don’t remember, it will not override the informations but only show the same result again. By the way, you can safely delete seeds.rb at this point.
  15. Change the configurations (like your password, and blog_url) in the Options section of the admin.

On Heroku

Please note that Heroku apps are not allowed to write on the file system so uploading images via CKeditor will not work.

  1. Issue a heroku create [NAME OF YOUR HEROKU APP]
  2. Copy database.yml.tpl to database.yml and modify the configurations if needed
  3. Issue a rake db:migrate
  4. Issue a rake db:seed and you should see “You’ve Successfully Loaded your blog’s initial data.” along with your Admin Username and Password.
  5. Issue a heroku db:push
  6. Create a file called .gems and write the gems that you will need, separated by a new line. (Note: Last time I tried, I needed to write activerecord without the underscore for it to work on Heroku).
  7. Remove the line config/database.yml in the .gitignore file.
  8. Commit your changes
  9. Issue a git push heroku master
  10. Once the site is live, go to http://[NAME OF YOUR HEROKU APP].heroku.com/admin and login with your infos that you got when you previously ran rake db:seed. Run it again if you don’t remember, it will not override the informations but only show the same result again. By the way, you can safely delete seeds.rb at this point.
  11. Change the configurations (like your password, and blog_url) in the Options section of the admin.