[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?