Search…
Docker only example - Voting App

Overview

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.
3. Refresh your repositories by clicking on the circle on the right hand side of the list of repositories
4. Select the release-example-voting-app repository, it will default to "master" branch.
5. 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.
6. 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.
7. 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.
8. 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.
9. 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.

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.
Environment Index screen
Click on the Environment <user-branchName> link on the left of the screen to view details about this environment.
Environment Details screen

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.
1
git clone [email protected]:{your-org}/release-example-voting-app.git
Copied!
2. Create a branch for your changes
1
cd release-example-voting-app
2
git checkout -b your-branch
Copied!
3. Navigate to release-example-voting-app/vote
1
cd vote
Copied!
4. Edit app.py 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.
1
from flask import Flask, render_template, request, make_response, g
2
from redis import Redis
3
import os
4
import socket
5
import random
6
import json
7
8
option_a = os.getenv('OPTION_A', "Option 1")
9
option_b = os.getenv('OPTION_B', "Option 2")
10
hostname = socket.gethostname()
11
12
app = Flask(__name__)
Copied!
5. Commit and push the changes to your repository.
1
git add .
2
git commit -m "changed options"
3
git push origin your-branch
Copied!
6. Now login to Github and create a Pull Request on this branch by clicking Compare & pull request
7. 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.
8. 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.
Beginning a deployment
9. 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.
Last modified 5mo ago