The MIT Tech
Development Box (VM) Setup
- Install Vagrant.
- Install VirtualBox.
- Install ChefDK.
- Install Vagrant Berkshelf plugin:
vagrant plugin install vagrant-berkshelf.
- Launch your development box:
vagrant up. This should take 5-15 minutes.
- Connect to your development box:
- In your development box, go to
~/appand launch the Rails server:
cd app && bundle exec rails server.
- You can now access the website in your host machine at
http://localhost:3000. First-time access is expected to be slow (around 10-20 seconds) due to the need to ramp-up various caches on the homepage.
~/app directory in the development box is synced with the git repository directory on your host machine. This way you can work directly on the host machine, and have the changes synced into the development machine automatically.
You can access the CMS backend at
http://localhost:3000/admin. The default admin account has email
firstname.lastname@example.org and password
Current limitations of the development box:
- Editing images (including uploading new images and deleting existing images) will not work. However, existing images should display normally on the development box website. Reach out to Techno Director if you need to work on related functionalities.
- Elasticsearch indices are not set up by default. See section "(Optional) Set Up Elasticsearch Indices" for more details.
(Optional) Set Up Elasticsearch Indices
By default, Elasticsearch indices are not created in the development box, since the initial indexing can take quite a bit of time. Therefore, frontend search functionalities will not work. If you need to work on related functionalities, do the following in the development box to create the needed Elasticsearch indices:
$ cd app $ bundle exec rails console > Article.reindex > Image.reindex
- Make your awesome changes.
- Add your changes to the Git staging area:
git add <changed_files>.
- Commit your changes:
git commit -m "Some message better than this".
- Rebase your changes to make sure you're staying on top of the newest
git pull --rebase origin dev.
- Push to the
git push origin dev
- Ping the Techno Director, to have the changes merged into master, and deployed to the staging/production website.
Commonly Used Commands
Unless otherwise specified, the following commands should be executed in the development box under the directory
- Start the Rails server:
bundle exec rails server.
- Launch the Rails console:
bundle exec rails console.
- Open a PostgreSQL database console:
psql thetech-dev -h 127.0.0.1 -U thetech.
Deployment Environment Variables
The following environment variables should be set on staging/production servers (also note that
production environment should be used for both staging and production):
# Amazon AWS AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY S3_BUCKET S3_HOST_NAME # PostgreSQL database DB_DATABASE DB_HOST DB_PASSWORD DB_USERNAME # Secret keys DEVISE_SECRET_KEY SECRET_KEY_BASE # App configuration RAILS_ENV