This directory contains tools that were created to manage Gilmation servers and the software that ran on them. As you'll see from the git history the only directory that I've touched in the last 13 years is thor. I just reviewed the json and time(tt) tasks to get them running.
- Scripts - Bootstrap scripts and other utilities written in bash.
- Chef - System configuration scripts (mainly chef standalone). Chef Repo
- Thor - Deployment, backups and storage of the backups in Amazon s3. Thor Repo
The scripts directory contains OS specific scripts that can be used to bootstrap a new instance into a state suitable to run something a bit more "cultured" :-), in our case Chef.
- Connect to the given host (arg 2) as the given user (arg 1)
- Copy over the setup script from this directory
- Run the setup script
- Install the minimum config necesary for a Ruby environment (Ruby and Gems)
- Use Gems to install ohai and chef (and their dependencies)
- Copy this users public key to the .ssh dir on the given server
- Setting up the connection so that it won't ask for a password
- NOTE: only for use by someone who knows what they are doing
- Setup the iptables (firewall) for a given ubuntu machine
The chef directory contains a script launch and the chef-repo directory.
- Installs the chef cookbooks
- Installs the $HOME/.ee/$PROJECT_NAME_site_node.json file (whcih contains the configuration necessary for this node)
- Runs the cookbooks using chef-solo and the $PROJECT_NAME_site_node.json configuration file
NOTE: You need to run the following command first so that the launch file can connect over ssh without having to use ssh -i
ssh-add $KEY_FILE_LOCATION
These are opscode / 37 signals cookbooks that have not been modified and can be overridden by the cookbooks contained in the following directory
This directory contains the gilmation specific cookbooks that we run in order to configure the standard gilmation.com server.
The recipe that does most of the hard yards here is - gilmation_ee/recipes/default.rb. This recipe calls the other site specific recipes and as well as installing the software necessary for gilmation.com it also prepares directories so that we can deploy the Expression Engine code easily with Capistrano and administer the Database with Thor.
Thor is a gem that allows you to write scripts in ruby (like rake) but then install them and have them available to you wherever you are on a given box.
You can see a list of all the tasks and their descriptions (like Rake or Capistrano), by typing:
thor -T or thor list
A list of tasks for deployment, backups and restore of Expression Engine and it's Database.
-
Download the EE2 codebase and install it in your development area
-
Define a config file for your project at ~/.ee/$PROJECT_NAME.yml
-
Run
thor ee:deploy_local -f $PROJECT_NAME.yml
-
Create a virtual host entry (Apache)
-
Use ghost or /etc/hosts to direct the hostname to your machine
-
Set up the file permissions in the EE2 development directory as per the EE install page
-
Create the DB schema and user (The chef recipe for Mysql contains the SQL necessary)
/usr/bin/mysqladmin -u root -p$PASSWORD create $DB_NAME GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, ALTER, DROP ON $DB_NAME.* to '$USERNAME' IDENTIFIED BY '$PASSWORD'
-
Create a .gitignore file with
thor ee:create_gitignore -f $PROJECT_NAME.yml
-
Run the EE2 install (http://$SERVER_NAME/$SYSTEM_DIR)
-
Run the Thor task to move the configuration files that have just been updated and create symbolic links to them:
thor ee:move_link_config -f $PROJECT_NAME.yml
A couple of generic methods for use by other gilmation projects.
Mysql specific tasks
Amazon S3 tasks - upload and retrieve. - Added .bk extension to exclude file as it seems that the right_aws gem hasn't been updated since 2013.
Some very simple time tracking helpers and a template to produce a report
Does exactly what is says on the tin… Utility / Helper methods
Check the version of the installed OS(either in a local window or ssh into the box):
cat /etc/issue; cat /etc/lsb-release
Change into the scripts/ubuntu_bootstrap directory
cd scripts/ubuntu_bootstrap
Run the ssh setup script if you don't want be typing your password all the time (NOTE: You must have a .ssh dir created on your working machine)
./sshSetup hgilmour 172.16.193.129
Run the launch script:
./launch hgilmour 172.16.193.129
Change to the chef directory
cd ../../chef
Run the launch script (You'll have to enter your password for the first sudo command)
./launch hgilmour 172.16.193.129
Change to the thor directory
cd ../thor
Run the launch script (copies the required files over to the target machine)
./launch hgilmour 172.16.193.129