WG/OBIT/Creating A Develpment Environment for groups version 2

From wiki.occupyboston.org
Jump to navigation Jump to search

Setting Up Local Environment

In order to set up a local environment, you'll probably want a LAMP, WAMP or MAMP server setup installed. You will likely find the most flexibility using LAMP. You could use this quickstart guide. If you do not have a server setup on your local computer, someone from OBIT will be happy to help you get this installed and configured.

The rest of these instructions assume that you have a working server and the ability to create domains on your local machine.

Creating A Drupal Instance

  • Download and extract the most recent version of drupal. http://drupal.org
  • Make a directory for your web root.
$ mkdir dev2groups; cd dev2groups

  • Create links to your drupal files
$ ln -s /path/to/drupal-7/* ./
$ ln -s /path/to/drupal-7/.htaccess ./
$ ln -s /path/to/drupal-7/.gitignore ./
$ mv sites notsites
$ mkdir sites
$ cp -r notsites/* sites/

  • Create a mysql database
$ mysql -uMYSQLUSER -p
mysql> create database dev2_drup;
mysql> exit;

  • Install drupal by opening your web browser and going to http://mysite.local (or whatever you named your domain).
  • Clone the git repository using the following set of commands from your local web root directory
$ git init
$ git remote add dev ssh://obv2dev@attucks.mayfirst.org/home/members/occupyboston/sites/v2dev.groups.occupyboston.org/include/site_hub/
$ git fetch dev
$ git merge dev/master

  • Copy and edit the sync script in the ./dev directory.
$ cp sync.v2devgroups.example sync.v2devgroups
$ gedit sync.v2devgroups

  • Change the following lines by adding your database name, database user name and database password:

local_db=YOUR_DATABASE_NAME local_db_user=YOUR_DB_USERNAME local_db_pass=YOUR_DB_PASSWORD

  • Save the file
  • Sync the database and files. From the root web directory run:
$ ./dev/sync.v2devgroups

Making Changes

At this point you should have a working local development environment synced to the remote development website. Most of the changes we will make to the site will occur in our git repository. Once you have made changes you want everyone to have access to, you'll need to add those changes to the git repository. Some helpful commands:

  • See current status
$ git status

NOTE: You may see some untracked files when running this command that should remain untracked. We do not want core drupal files in the git repository, only files in the sites/all or sites/libraries directories.

  • Sync up the repository
$ git pull dev master

  • Add new files to the repository
$ git add PATH/TO/FILENAME

  • Commit your changes -- In order to tell the server there are changes you need to commit them to the repository.
$ git commit -am"Describe why you made the changes"

  • Push your changes to the dev server. When you issue the following command your changes will be active on the development website
$ git push dev