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...

Nachtschatten-Update

Vor einigen Tag habe ich die Tomatenpflanzen rausgestellt, einige sind dabei allerdings so stark verbrannt, dass ich ein Überleben bezweifle. Andere Pflanzen waren allerdings schon so stark, dass die Sonne ihr Wachstum sehr positiv beeinflusste. Diese Erfahrungen werden eine Rolle spielen bei der Aussaat nächstes Jahr. Für die Tomaten muss ich nur noch die Pfähle setzen, nachdem wir gestern den Spinat (im Bild vorne) abgeerntet hatte: als Salat mit Feta, Walnüssen und einem Dressing von Senf und Zitronensäure. Meine Chilis haben die Sonne sehr gut vertragen, und werden die nächsten Tage in ihre Beete verteilt.