Script for migrating between servers

18 views
Skip to first unread message

Simon Smithies

unread,
Feb 5, 2012, 5:54:13 PM2/5/12
to Zotonic users
Hi all,

I run a zotonic installation on my local machine for building
templates and initial testing. When things are ready to go, I copy the
site to a parallel production system running on a VPS. I'd like to
automate this.

I thought zotonic's copysite script might do the trick but it seems to
assume the destination is local, which means I'd run it when logged
onto the VPS, but from there I can't see my local machine. My ssh
skills are very limited, so it's entirely possible I'm missing
something here.

How do the rest of you handle this? Copysite? Your own scripts? Any
tips/examples would be much appreciated!

Cheers, Simon

Andreas Stenius

unread,
Feb 6, 2012, 3:37:28 AM2/6/12
to zotoni...@googlegroups.com
I keep my site in a git repo. For private sites, I have my own git
server that I push to from my local machine, and pull from from the
production server. The nice thing is that small typos I find on the
production server is easily fixed ad-hoc and pushed to the master git
repo, from which I can later pull to my dev machine to keep in sync...

I've not automated this, but some steps could absolutely be automated.
Like having the production server pull in changes periodically from a
production branch for instance. That way I could push to the
production branch from my dev machine whatever changes I'd like to
have in production.

Cheers,
Andreas

2012/2/5 Simon Smithies <simon.s...@gmail.com>:

Simon Smithies

unread,
Feb 22, 2012, 4:17:22 AM2/22/12
to Zotonic users
Thanks for the reply Andreas - and sorry to be so slow in
acknowledging it.

I can see how that approach would work well for site templates and
css. What do you do about content? - in particular the database.

On Feb 6, 9:37 pm, Andreas Stenius <andreas.sten...@astekk.se> wrote:
> I keep my site in a git repo. For private sites, I have my own git
> server that I push to from my local machine, and pull from from the
> production server. The nice thing is that small typos I find on the
> production server is easily fixed ad-hoc and pushed to the master git
> repo, from which I can later pull to my dev machine to keep in sync...
>
> I've not automated this, but some steps could absolutely be automated.
> Like having the production server pull in changes periodically from a
> production branch for instance. That way I could push to the
> production branch from my dev machine whatever changes I'd like to
> have in production.
>
> Cheers,
> Andreas
>
> 2012/2/5 Simon Smithies <simon.smith...@gmail.com>:

Michael Connors

unread,
Feb 22, 2012, 4:28:15 AM2/22/12
to zotoni...@googlegroups.com
Hi Simon,

On 22 February 2012 10:17, Simon Smithies <simon.s...@gmail.com> wrote:
Thanks for the reply Andreas - and sorry to be so slow in
acknowledging it.

I can see how that approach would work well for site templates and
css. What do you do about content? - in particular the database.

For files I use rsync for the files, and something like this for the data:

MyFile=my_backup-$(date +%Y%m%d).sql
pg_dump -U zotonic zotonic > $MyFile;scp $MyFile my_backup_server://home/zotonic/home/my_backups;rm $MyFile

This is a shell script which I execute using cron. If you wanted a constant backup you could use PostgreSQL replication.

Michael

Andreas Stenius

unread,
Feb 22, 2012, 7:10:00 AM2/22/12
to zotoni...@googlegroups.com
At the moment I don't replicate the db data...


2012/2/22 Michael Connors <conn...@gmail.com>:

Reply all
Reply to author
Forward
0 new messages