Skip to content
Bot that adds/updates content on opentwincities.org
Python
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
app feat: add venue_name and venue_location for json Oct 11, 2019
tests test: new basic tests for calendar, json, and rss Oct 10, 2019
.gitignore Starting on a Git Client Jan 16, 2017
.python-version accommodating pyenv Oct 2, 2019
.travis.yml Updating CI to run tests on Ubuntu Bionic, the version site_bot now r… Oct 14, 2019
LICENSE.md
README.md expanding README Oct 13, 2019
app.py fix: use event[time] for create_filename Oct 11, 2019
deploy_key.enc Setting up repo for automatic deploys on tags Oct 12, 2019
deployment-requirements.txt
fabfile.py Support deploying specified branches/tags Oct 12, 2019
requirements.txt build: add feedparser and icalendar to requirements Oct 10, 2019

README.md

Build Status

Open Twin Cities Site Bot

A bot that automatically adds and updates content on http://www.opentwincities.org.

OTCSB uses the Meetup.com RSS feed to get events, then uses a local copy of the OTC GitHub Pages repository to commit those events to the repo.

Setup

Dependencies

Details for usage with pyenv

Assuming pyenv is installed and initialized.

pip install virtualenv
pip install virtualenvwrapper
brew install pyenv-virtualenvwrapper
pyenv virtualenvwrapper

Environment Variables

The following environment variables must be set:

  • SITE_BOT_REPO_AUTHOR_NAME: Name to be included for the commit author
  • SITE_BOT_REPO_AUTHOR_EMAIL: Email Address to be used for the commit author
  • SITE_BOT_MEETUP_GROUP_NAME: Name of the group to get events from
  • SITE_BOT_MEETUP_API_KEY: API key from Meetup

opentincities.github.com repo

Events appear on opentwincities.org by committing to the opentwincities.github.com repo. This repo must be in a subfolder named opentwincities.github.com.

You'll probably want to author and push commits to the [opentwincities.github.com repo] as a user other than your personal git/GitHub user. SSH config can be used to enable this. See http://stackoverflow.com/questions/7927750/specify-an-ssh-key-for-git-push-for-a-given-domain

Dev Environment

If you have the opentwincities.github.com repo locally, you can create a symbolic link to it. This example assumes your opentwincities.github.com and site_bot repos are in the same directory:

ln -s ../opentwincities.github.com opentwincities.github.com

To prepare you project for a local run execute

git clone git@github.com:OpenTwinCities/site_bot.git
cd site_bot
mkvirtualenv site_bot
workon site_bot
pip uninstall -y -r <(pip freeze)  # Uninstall any packages that exist in the virtualenv
pip install -r requirements.txt

Running the tests

nosetests

Tag & Deploy

This repository is setup to automatically deploy when a tag is pushed. Thus, to deploy, somebody with write access to the repository can:

git tag                   # Find latest tag, decide what the next version should be based on SemVar
git tag X.Y.Z -a
git push origin tag X.Y.Z

This will cause Travis CI to run unit tests, then deploy if the tests pass.

Deployment Details

Deployed Environments

Site bot is currently deployed on an EC2 instance in Open Twin Cities' AWS account. The public domain name of that instance is ec2-52-6-202-131.compute-1.amazonaws.com. Site bot is scheduled to run once an hour via cron. This cron configuration also sets the Environment Variables for the script.

Manual Deployment

pip uninstall -y -r <(pip freeze)  # Uninstall any packages that exist in the virtualenv
pip install -r deployment-requirements.txt
fab \
  -H USERNAME@HOST:PORT \
  -i PATH_TO_PRIVATE_KEY \
  deploy --ref BRANCH_OR_TAG_TO_DEPLOY

Note: The site_bot repo must already be cloned on the host that is being deployed to and located in /opt/site_bot. The opentwincities.github.com must also already be cloned in /opt/site_bot/opentwincities.github.com The user whose authentication is being used by fabric must also have read and write permission on /opt/site_bot.

Run the application

python app.py
You can’t perform that action at this time.