dotcms website sourcecode

52 views
Skip to first unread message

Kiran K

unread,
Jul 20, 2012, 10:58:48 AM7/20/12
to dot...@googlegroups.com
Hi,

I am new person to dotCMS. I am wondering how we can store all source we create in dotCMS into SVN/CVS. (Source code like templates, vtl, containers, relations).. is there anyway to do this? If my server crashes, how do I rebuild from these files? Do we have any ant script to build these back?

Thank you,
Kiran

Jorge Urdaneta

unread,
Jul 20, 2012, 11:09:16 AM7/20/12
to dot...@googlegroups.com
You might want to backup your database, indexes and asset folder.

Take a look at out doc http://dotcms.com/docs/2.0/BackupAndRestore
Maybe we should extend it. Any feedback is appreciated.

--
Jorge Urdaneta
dotCMS Developer

--
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.
To view this discussion on the web visit https://groups.google.com/d/msg/dotcms/-/hZTP8hZD2xUJ.
To post to this group, send email to dot...@googlegroups.com.
To unsubscribe from this group, send email to dotcms+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/dotcms?hl=en.

Todd Reed

unread,
Jul 20, 2012, 11:21:38 AM7/20/12
to dot...@googlegroups.com

Kiran,

 

                We run Linux/PostGreSQL for our dotCMS setup.  Below is our backup and recovery scripts for dotCMS system. 

 

For Backup:

From a remote Linux server, we created Password-less SSH sessions between the “backup” server to the dotCMS server and to the PostGreSQL server.  We also use PGPass to the PostGreSQL server.

 

We initiate a RSync over SSH copy to get the dotCMS assets, etc.  We also get a dump of the database.  Here is the scripts I use that is initiaged on the backup server:

 

#!/bin/bash

exec &> capture.txt

 

echo Running daily.sh: $(date)

echo ==================================================================================

echo

 

echo Updating Search Database: $(date)

echo ==================================================================================

/usr/bin/updatedb

echo ===COMPLETE: Updated search database

echo

 

echo Dumping Postgres dotCMS Databases: $(date)

echo ==================================================================================

echo === template1: $(date)

pg_dump -o -O -i -h db-postgres -U postgres template1 > /opt/backup/ db-postgres /template1.sql

echo === dotcms_dcprod: $(date)

pg_dump -o -O -i -h db-postgres -U postgres dotcms_dcprod > /opt/backup/ db-postgres /dotcms_dcprod.sql

echo === postgres: $(date)

pg_dump -o -O -i -h db-postgres -U postgres postgres > /opt/backup/ db-postgres /postgres.sql

echo

echo ==COMPLETE: Postgresql Database Dump

echo

 

echo Downloading backup from dc-prod: $(date)

echo ===================================================================================

rsync -avz --delete -e"ssh -i /root/.ssh/id_rsa" backupagent@dc-prod:/opt/ /opt/backup/ dc-prod --bwlimit=1581

echo ===COMPLETE: RSYNC from dc-prod

echo

 

echo

echo Process Complete: $(date)

echo ==================================================================================

 

#Sending Status Report

mail -s "BACKUP REPORT: cvbackup " root@localhost < /root/capture.txt

 

 

 

To run a restore, this is what we do from the actual dotCMS host server:

#!/bin/bash

 

function progress(){

echo -n "Please wait..."

while true

do

     echo -n "."

     sleep 2

done

}

 

# Starting Scripts

echo "Stopping dotCMS"

/etc/init.d/dotCMS stop

 

echo "RSyncing Database"

rsync -avz --delete service@cvbackup:/opt/backup/db-postgres/dotcms_dcprod.sql ~/dotcms_dcprod.sql

rsync -avz --delete service@cvbackup.:/opt/backup/dc-prod/dotcms/dotserver/dotCMS/assets /opt/dotcms/dotserver/dotCMS

rsync -avz --delete service@cvbackup.:/opt/backup/dc-prod/dotcms/dotserver/dotCMS/reports /opt/dotcms/dotserver/dotCMS

rsync -avz --delete service@cvbackup.:/opt/backup/dc-prod/dotcms/dotserver/dotCMS/dotsecure/dotlucene /opt/dotcms/dotserver/dotCMS/dotsecure

 

echo "Dropping old Database"

dropdb -h db-postgres -U postgres dotcms_dcprod

 

echo "Creating new Database and assigning permission"

createdb -h db-postgres -U postgres -O dcprod dotcms_dcprod

 

echo "Populating new database from Production Dump"

psql dotcms_dcprod -h db-postgres -U dcprod -f ~/dotcms_dcprod.sql

 

echo "Deleting Production SQL Temp File"

rm -rf ~/dotcms_dcprod.sql

 

echo "Purging existing dotCMS Cache"

rm -rf /opt/dotcms/dotserver/dotCMS/dotsecure/h2db/*

rm -rf /opt/dotcms/dotserver/dotCMS/dotsecure/dotlucene/*

rm -rf /opt/dotcms/dotserver/dotCMS/dotsecure/esdata/*

 

#echo "Deleting old log files"

rm -rf /opt/dotcms/dotserver/tomcat/logs/*

 

echo "Cleaning Up Database"

psql dotcms_dcprod -h db-postgres -U dcprod -c "DELETE FROM clickstream;"

psql dotcms_dcprod -h db-postgres -U dcprod -c "DELETE FROM clickstream_request;"

psql dotcms_dcprod -h db-postgres -U dcprod -c "DELETE FROM clickstream_404;"

vacuumdb -h db-postgres -U dcprod dotcms_dcprod

reindexdb -h db-postgres -U dcprod dotcms_dcprod

 

#echo "Starting dotCMS"

echo "dotCMS needs to be started manually"

#/etc/init.d/dotCMS start

 

sleep 2

 

#tail -f /opt/dotcms/dotserver/tomcat/logs/dotcms.log

 

echo "------------------------------------------------"

echo "Don't forget to run dotCMS Maintenance"

echo ""

~

~

--

Kiran K

unread,
Jul 20, 2012, 12:08:59 PM7/20/12
to dot...@googlegroups.com
These will definitely help me. Thank you very much for your help...

Kiran K

unread,
Jul 20, 2012, 12:16:14 PM7/20/12
to dot...@googlegroups.com
Another question :) - As far as I understand from this is we can keep backups of dotcms export file and db backups. Can we somehow keep source in svn so we can maintain versions for templates.. check the  differences, tag the source and make build etc? or that is not the way CMS servers work?

Jorge Urdaneta

unread,
Jul 20, 2012, 12:30:14 PM7/20/12
to dot...@googlegroups.com
I don't think it is the intended use case for svn.

--
Jorge Urdaneta
dotCMS Developer

On Fri, 2012-07-20 at 09:16 -0700, Kiran K wrote:
Another question :) - As far as I understand from this is we can keep backups of dotcms export file and db backups. Can we somehow keep source in svn so we can maintain versions for templates.. check the  differences, tag the source and make build etc? or that is not the way CMS servers work?



--
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.
To view this discussion on the web visit https://groups.google.com/d/msg/dotcms/-/6JNmjMgbEqUJ.

Chris Falzone

unread,
Jul 20, 2012, 1:48:47 PM7/20/12
to dot...@googlegroups.com
So, what some people do here is they store they implementation code in vtl files.

Then in their templates/containers/widgets the vtl files are parsed.  The files are edited over webdav in dotcms, and then manually (or by some process) the vtl files are synced with a source control system like svn.

I don't generally like this, to me it seems to complicated and too many moving pieces and makes issues harder to debug.

FWIW, dotcms keeps tracks of all the versions of everything anyway, so there really shouldn't be a need for an external system to do this.
Reply all
Reply to author
Forward
0 new messages