[email protected]:davjand/ci-workspace
@author: David Anderson @date: 01/08/2012 @version: 0.2
The Continuous Integration (CI) Workspace is designed to allow automation of common migration tasks within symphony with the goal of achieving a continuous-integrated project.
Most of this workflow can be utilised without the continuous integration server, most of the steps can be initiated manually giving you the same benefits with less automation.
This is designed with the following architecture:
- The source code is entirely managed via github
- Each developer develops on their own local install of symphony
- There is a 'staging' server in which user based and content testing occurs
- There is a 'live' server in which the website runs and live data is stored in the database
- There is a continuous integration server that initiates the migration of code
- (IN PROGRESS) There is a continuous integration server that unit tests the code.
The workflow is summarised as below:
- Developers work on a local install and commit their code to github
- The continuous integration server thus monitors the git repository and migrates changes that pass the unit tests to the staging server
- These changes can then be 'pushed' to the live server when required (ideally weekly)
- Database migrations extension (davjand/database-migrations)
- A git repository
- Two server domains (for staging and testing)
- (Optional) A
The following are the different cases of using the system
- Initial Setup for a new site
- Setup of a 'second' local developer
- Migrate changes between local installs
- Setup of a 'remote' staging server
- Updating a 'remote' staging server
- Setup of a 'remote' live server
- Release of a new live version to the live server
- Setup a local server (ie XAMPP)
- Create a git repository that is accessible via localhost (git init)
- Add your origin remote (git remote add origin [email protected]:your-name/repo-name)
- Download the setup.sh file (build/setup/setup.sh) to the root of your git repository and run (sh setup.sh)
- (Optional) Open setup_extensions.sh in a text editor and uncomment any desired extensions oradd your own
- (Optional) Run setup_extensions.sh (sh build/setup/setup_extensions.sh)
- Open your browsers to the public_html/install directory
- Run the symphony installation wizard and remove the install directory
- Commit your initial site to your repository (git add -A, git commit -m "Initial Commit", git push origin master)
You're now setup with a fully tracked repository that will migrate database changes.
This assumes that you have a second machine from which you want to work on the project on with git fully setup.
- Setup a local server (ie XAMPP)
- Create a git repository that is accessible via localhost (git init)
- Add your origin remote (git remote add origin [email protected]:your-name/repo-name)
- Pull your repository from origin (git pull origin master)
- Run the install script (sh build/install_local.sh)
- Open your browsers to the public_html/install directory
- Run the symphony installation wizard and remove the install directory
- Commit your initial site to your repository (git add -A, git commit -m "Initial Commit", git push origin master)
You're now setup with a fully tracked repository that will migrate database changes.
A developer has made changes to a repository or database on a different machine and pushed to git
- Pull changes from git / update any submodules
- Load up any symphony page to initiate a database upgrade
For this to work it, you will need the following: SSH access to the server and access to git & curl on the server.
You need to do the following:
- Setup SSH Keys
- Setup git and run the install scripts.
###Setting up the ssh keys
Please see this github article for setup options. My workflow is with a github dummy account. I add the ssh keys to this and add the account as a collaborator to the account
- SSH to your server
- Change to the ssh key directory (cd ~/.ssh)
- Generate a key (/usr/bin/ssh-keygen -t rsa -C "[email protected]")
- Hit enter to use the default file and leave the passcode blank. Yes this does make things more vulnerable but it is an absolute pain otherwise. Provided the private key stays on the server and nowhere else, you'll be fine.
- Login via ftp or similar and open your public key file (probably at .ssh/id_rsa.pub)
- Paste this into you ssh keys on github
###Setting up git & installing
The repository is setup such that it contains public_html as a subdirectory. Because of this you need to delete all files from your server that you don't need (including the existing public_html directory. Any that you can't delete should be added to the .gitignore file so that they don't get added into the repository and cause you issues.
- SSH to your server
- Initialise git in your home directory (/usr/bin/git init)
- Add your remote (/usr/bin/git remote add origin [email protected]:your_name/your_repo
- Pull the remote (/usr/bin/git pull origin master)
- Run the install script (sh build/install_staging.sh)
- Load the website up in your browser to complete the symphony install process
- Login to your site and you'll be prompted to update the database (if you've made changes) and to remove the install directory, do both of these!
Now you're setup!