Direkt zum Hauptbereich

rails deployment with sqlite3 in production too - cms online AND offline

After starting to use refinerycms I ran into some problems with my settings after deploying my app with capistrano.

First of all I was concerned with how the cms would work:
  • somebody does something offline, e.g. coding a view
  • and online somebody is writing a page or creating users
How would this go together without dataloss?

I ask my question and got some good answers - quick as well:
deployment to production with capistrano to vserver - consistency question regarding databases and cms settings - NOT heroku

Bottom line was:

  • refinerycms is using files for settings
  • online users will just work with the database,
  • offline users/coders do scripting
  • therefore merging is easy

For me it was not that easy at all because I used sqlite3 for developement and production and had to tell capistrano how to keep ONE database alive while rolling out releases:

in database.yml

production:
  adapter: sqlite3
  database: /var/www/*****/shared/production.sqlite3
  pool: 5
  timeout: 5000

And at the end of my deploy.rb
after "deploy:update_code", "preconfigure"
desc "Configure the application with correct database"
task :preconfigure, :roles => :app do

# symlink database.yml: copy if not exists, then link it back (release/config/database.yml -> shared/database.yml)
run "cp -n #{release_path}/config/database.yml #{shared_path}"
run "ln -sf #{shared_path}/database.yml #{release_path}/config/database.yml"
# symlink database file and backup current one
run "ln -sf #{shared_path}/production.sqlite3 #{release_path}/db/production.sqlite3"
run "touch #{release_path}/db/production.sqlite3" # make sure at least empty file exists so it can be copied
run "cp #{release_path}/db/production.sqlite3 #{release_path}/db/production.sqlite3.backup"

end

after 'deploy:update_code', 'deploy:migrate'


And it works fine so far!

Kommentare

Beliebte Posts aus diesem Blog

rails + carrierwavve + plupload = multiple file upload

Right now I am very happy! I finished my work on creating a file upload method in rails for more than one file, altogether handled by rails sessions and as objects. First I had to learn a bit more about how rails works and I achieved that by reading a lot: books, screencasts and blogs. In this blog post I like to share what I accomplished, but without the hussle of putting code blocks in here, so watch out for bold formatted text as that is the code. My goal was to have one site with just the pure option of uploading files. All file handling would be done behind the scenes by myself logging onto my server. That said you are not going to see any fancy CRUD here. Lets start then! And dont forget to versioning your app BEFORE you try something new! [e.g. git] > rails g scaffold Photo title:string Now add carrierwave to you Gemfile and run > bundle install >rails g uploader Photo Alltogether you have model, controller, views and an uploader folder with the Ph...

LEGO Alternativen: Sluban und COBI

Ich habe vor kurzem wieder Feuer gefangen für LEGO. Und das kam durch die Dokumentation über die Errichtung des LEGO-Hauses in Billund. Also habe ich meine Steine gereinigt und die Kinder fangen gerade an, auch mal etwas zu bauen. Teilweise stammen meine Steine aus den 1970ern, 1980er und viel aus den 1990ern - alles passt noch wunderbar aufeinander. Viele Designs von LEGO gehen doch Wege, die ich selber nicht so toll finde. Ausserdem verstehe ich nicht, dass etliche Designs aufgegeben wurden. Letztere Sets findet man dann zu horrenden Preisen auf den einschlägigen Plattformen. Also sah ich mich um, denn das Patent für das Baustein-Prinzip ist abgelaufen und andere Firmen produzieren auch Stecksteine. Sluban ... ist Mist und wird von mir nie mehr gekauft. Die Firma stiehlt von LEGO, hat aber auch interessante Designs. Gerade bei militärischen Sachen findet der Fan einige gut aussehende Sets. Aber die Steine wirken nicht besonders toll, es gibt Macken, die Anleitung kön...

debian 6 vserver - a new installation due to centOS update problem - my steps

My centOS vserver broke down after a "yum update" and even the centOS community forum could not give an answer within 24h. In my books that is poor for the almighty and stable centOS. Bare in mind that I am just a normal user of linux, no professional and definitely no expert when it comes to server, but I can read, try and share my findings: debian 6 installation steps via ssh secure your server: adduser foobar for security purposes  change /etc/sshd/sshd_conf to PermitRootLogin no now you can login as foobar and change to root via su - visudo for sudo command permissions and put this at the bottom: foobar   ALL=(ALL) ALL change hostname change hostname in /etc/hostname and in /etc/hosts reboot login via rsa key rather than password locally do ssh-keygen ssh-copy-id -i foobar@hostname... ssh now works without passwords but with keys (for easy deployment) install ruby and rails via rvm login as root always good to have: sudo apt-get install...