Docker only example - Voting App


The example voting application is a dockerized application that contains three services, Vote, Result and Worker along with a postgres database and redis. It demonstrates how a Release application is setup with a simple docker-compose file and can easily be deployed and managed by Release.

Fork the repository on Github

  1. On Github, navigate to the releaseapp-io/release-example-voting-app repository.

  2. In the top-right corner of the page click Fork.

Login to Release and refresh your list of repositories

  1. Login to your Release account.

  2. Click Create New Application on the left hand sidebar.

  1. Refresh your repositories by clicking on the circle on the right hand side of the list of repositories

Refresh and select a repository/branch
  1. Select the release-example-voting-app repository, it will default to "master" branch.

  1. After the different services load up, take a moment to observe that they are all Docker type and review the default port assignments. You'll also see that "result" and "vote" services both have public generated URL hostnames because they are public-facing ports. The "db" and "redis" services are private, so they will not have hostnames. The worker doesn't require a port. For reference, these different port configurations can be found in the docker-compose.yml file in the voting app repository. Take a sec to look at it.

  1. At this point, you are welcome to modify your app name or keep the default, which is the name of the repository. Having a brief, yet descriptive app name is advisable to keep your environment URL hostnames from growing too long and cumbersome.

  2. Click "Generate App Template" to proceed, where you'll be able to view and edit your Application Template if needed. You have the ability to edit this later on, so for now, just read through the description, perhaps read our documentation on this topic, then click the "Save & Continue" button to move on to the next step.

Application Template Example
  1. The last step in the create app process is the Build & Runtime Configurations screen where you can edit Build Arguments, Default Environment Variables, and Just-in-time File Mounts. We won't be going into much detail on this during this exercise, but when it comes time to build your own application, you may want to read up on the documentation for these topics to better understand how to configure your initial build defaults in Release. Click "Start Build & Deploy" to continue on.

  1. After finishing up the last step, you will be directed to the Application Dashboard where you can view your Environment on the Activity log. Feel free to click on the Builds link to see a log output of your build happening. You can also click on the Deploys link to view deployment status as well. Once your Environment is fully deployed, you will see the status change to "complete" in the Activity log. Click on the hostname URLs to see the preview environments for "vote" and "results". Figure out what happens when you click on a voting button. In the next section, learn how to navigate around Release and create additional environments using a pull request.

Application Dashboard Example

Exploring Release with the Example Voting App

Select Environments from the left hand sidebar.

Select "Environments"

Once the application has been deployed, you'll have an ephemeral environment created. All of the details of this environment show up in the environment details page.

Click on the Environment <user-branchName> link on the left of the screen to view details about this environment.

Create a Pull Request

In your forked repository of releaseapp-io/release-example-voting-app create a branch and make a change to the code.

  1. Clone your repository locally.

git clone [email protected]:{your-org}/release-example-voting-app.git
  1. Create a branch for your changes

cd release-example-voting-app
git checkout -b your-branch
  1. Navigate to release-example-voting-app/vote

cd vote
  1. Edit and make a change to lines 8 and 9. Change "Cats" to some string you'd like to be the first option someone can vote on. Change "Dogs" to some string you'd like to be the second option someone can vote on in this application. When done, save the file.

from flask import Flask, render_template, request, make_response, g
from redis import Redis
import os
import socket
import random
import json
option_a = os.getenv('OPTION_A', "Option 1")
option_b = os.getenv('OPTION_B', "Option 2")
hostname = socket.gethostname()
app = Flask(__name__)
  1. Commit and push the changes to your repository.

git add .
git commit -m "changed options"
git push origin your-branch
  1. Now login to Github and create a Pull Request on this branch by clicking Compare & pull request

  1. Open the PR by clicking Create pull request - IMPORTANT, make sure you have your base set to your repository name, not the original repository that you forked this repo from. Otherwise you'll make a PR on the original, not the forked repo.

  1. A build will automatically start and a deployment of a new Release environment will kick off. You can view the deployment by clicking on the Deploys tab in Release.

  1. Once the Deploy has finished, you'll be able to view the Environment from the Environments tab in the sidebar.

Then click on that specific environment's hostname link in the middle of the screen and you'll see the preview environment open up in your browser. It will look like:

Subsequent pushes to your feature branch will automatically update this new environment. You can share the URL's created so anyone can access the environments and review your running application alongside your PR.