Pokestarter is a sample application created to use in the Creating a Continuous Integration/Deployment System workshop for the Grace Hopper Celebration of Women in Computing 2016. This application returns a random starter Pokemon as a web page and as an API call.
- Download and install Docker Toolbox
- Download and unzip ngrok
- Fork this repository
- Open Kitematic, which is included in Docker Toolbox
- Open the Docker CLI in Kitematic
- Clone this repository or download the docker-compose.yml file from GitHub
- Navigate in the Docker CLI to where the docker-compose.yml is located and run
docker-compose up
- The Jenkins, test environment, and production environment will be accessable through Kitematic
- Clone this repository or download the docker-compose.yml file from GitHub
- Navigate to where the docker-compose.yml is located and run
docker-compose up
- The jenkins and demo environments will be located at:
- Jenkins: http://localhost:8080
- Test Environment: http://localhost:5050
- Production Environment: http://localhost:5000
- GitHub, go to Settings -> Personal access tokens
- Click Generate new token
- Give the token a description and click the checkbox for repo:status
- Click Generate token and copy the created token
- In Jenkins, go to Manage Jenkins -> Configure System
- Scroll down to GitHub Pull Request Builder
- Click the Add button by Credentials
- Select Secret text as Kind
- Paste your access token into Secret and give it a name in the ID
- Click Add and then select your created credential
- Run ngrok to connect your local Jenkins to the internet using
./ngrok http <jenkins-ip>:8080
- Navigate to your forked repository on GitHub and go to Settings -> Webhooks
- Copy your ngrok URL into the Payload URL and add /ghprbhook/ to the end. There MUST be a / at the end of the URL, otherwise you will get a 403 error.
- Select Let me select individual events and check Pull request, Pull request review comment, and Issue comment.
- For pull request jobs, under Build Triggers, check Use github hooks for build triggering.
- Create a second webhook with /github-webhook/ at the end. Again, there MUST be a / at the end.
- Select Just the push event
- For the Trigger Pipeline job, check Build when a change is pushed to GitHub.
If you would like to run the web application outside of the Docker enviornmnets, you can use the following steps.
pip install -r requirements.txt
python pokestarter/app.py
Open a browser and navigate to http://localhost:5000.
Request
curl http://localhost:5000/api
Response
{
"pokemon": "Squirtle"
}
pip install -r test-requirements.txt
nosetests -sv tests/unit
nosetests -sv tests/functional