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

Virtuelles Wasser?!

In den letzten Tagen habe ich immer mal wieder etwas mit Rails programmiert und werde mich ebenso heute dem neuen Auftrag "multiple file upload" kümmern. Und weil vieles "Versuch-Irrtum" ist, gucke ich auf dem zweiten Monitor immer Reportagen. Letztens kam mir "Der große Haushaltscheck" unter die Finger: ARD Mediathek "Der große Haushaltscheck" In der Sendung vom 11.3.2013 ging es um unser Trinkwasser. Jedem sollte klar sein, dass Plastikflaschen nicht die erste Wahl sind, weil man nicht darauf vertrauen kann, dass der Hersteller wirklich "gutes" Plastik nahm (BPA, Phtalate, Benzol, Xylol usw.), aber das interessante waren die genannten Zahlen in puncto virtuellem Wasser bzw. Wassersparen. Wasser sparen an und für sich ist ja gut, nur heisst das nicht, dass wir weniger die Klospühlung benutzen sollten, sondern dass wir uns Gedanken machen über das "virtuelle Wasser". Unsere Kanalisation ist eine Schwemm-Kanalisatio...

Garten Juli-Update

Die Tomaten wachsen so langsam stetig, aber auch erst seit ein paar Wochen. Und da ich leider nicht rechtzeitig ausgegeizt hatte, ist einiges an Potential "verwachsen": Die Chilis wachsen auch ganz nett, wobei nur wenige Früchte zu sehen sind: Und gerade die Rocoto-Chili enttäuschen sehr: Aber einen Lichtblick habe ich: die Pimientos waren lecker und hier ist das "Rote Teufele":