CodeIgniter Forums
My app organization: local, dev, live with svn version control - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: My app organization: local, dev, live with svn version control (/showthread.php?tid=24590)



My app organization: local, dev, live with svn version control - El Forum - 11-13-2009

[eluser]summery[/eluser]
I wanted to share my app organization and see what other people are doing.

My requirements:
- Must have local, dev and live environments with 1-step load between them
- Must have my local code in ONE DIRECTORY which is under source control, including code like .htaccess, index.php, and browser-side css/ and js/ code.
- system/ and system/application code can't be in publicly accessible directories online

On my local site, I have the following structure:
Code:
ci_system_1_7_2/  'CI system files
dev/              'system/application files
  public/          'local web root with .htaccess etc.

Usually the .htaccess files are at the same level as the dev/ file. But I moved them into dev/public/ because that way all of my code under source control is in one directory.

On my dev site, I have the following structure:
Code:
ci_system_1_7_2/  'CI system files
dev/              'system/application files -- not publicly accessible
public_html/
  dev/             'subdomain's web root

My workflow:
- Code on local machine
- Commit changes to remote svn repository
- When I want to upload to dev, I ssh into my account and execute a little script which moves the public/ folder into a real public folder, and adjusts CI's application_folder setting accordingly

Code:
# svn2dev.sh
# Exports last committed version to dev site
#
# Go to home directory
cd ~

# Remove current dev site (secure and public code)
rm -r dev
rm -r public_html/dev

# Export svn to dev
svn -q export file:///home/my_user_name/svn/trunk dev

# Move files in dev/public folder to public_html/dev
mv dev/public public_html/dev

# Adjust config settings in index.php
cd public_html/dev
sed -i 's|application_folder = \"..\";|application_folder = \"../../dev";|' index.php

Is anyone else doing something similar - moving around folders and settings in between different environments? Are there improvements I should make?


My app organization: local, dev, live with svn version control - El Forum - 11-13-2009

[eluser]n0xie[/eluser]
I explained our basic testing/UAT/LIVE setup here.
You can use either rsync, phing or capistrano for deployment. Or of course just use ftp Smile


My app organization: local, dev, live with svn version control - El Forum - 11-13-2009

[eluser]summery[/eluser]
Tx for the link! I hadn't heard of deployment programs like Capistrano before. But it does look complicated - just trying to read their looong <a href="http://www.capify.org/index.php/From_The_Beginning">"From the Beginning"</a> page makes me happy about using a little shell script for deployment. Wink