Step 4 - Deploying to the Edge
In this guide we'll show you how to deploy your gateway to the edge, at over 200 data-centers around the world. The act of deployment creates new environments and it's worth familiarizing yourself with how environments work.
In this tutorial we'll show the default workflow via GitHub, but note that we also support GitLab, BitBucket (enterprise plan only) and custom CI/CD.
To follow this tutorial you'll need
- a github account (it's free, sign up at github.com).
- a zuplo project - complete Step 1, Step 2 and Step 3 for a great start!
- to install the Zuplo GitHub deployer to GitHub - you can do that here
1/ Connect to GitHub
First, we'll need to connect your project to GitHub. Go to Settings > Source Control. If your project isn't already connected to GitHub click the Connect to GitHub button and follow the auth flow. You'll need to grant permissions for any GitHub organizations you want to work with.
2/ Create the repo and connect the project
Once connected, you'll have the option to connect your project to source control by creating a repo.
You can choose the organization in the dropdown and choose a repo name (it doesn't have to be the same as the project name, but that is a good practice).
If you've already installed the Zuplo GitHub App your project will already be deploying to the edge.
You can check this by looking at your repo (click the link shown below)
You can see your deployment status in GitHub by looking for the (little) green check or orange dot by the last commit hash
If you click on the details link you'll see the deployment output from the Zuplo GitHub app. Including, how long it took (6s!) and the URL.
You can also see all your environments in Zuplo - head back to Zuplo and click the working-copy
link at the top left.
You should see a new main
environment which maps to your main
branch. This is typically your Production environment.
3/ Deploy another environment
Zuplo makes it easy for teams to collaborate by allowing teams to create many preview environments. To create a new environment, simple go to your repo in GitHub and create a new branch.
branch names dev
and prod
are keywords and not supported at this time.
Let's create a branch called development
Wait about 20s and head back to Zuplo - you should see a new entry in the environment dropdown called development
.
4/ Push a change to 'development'
Let's make a simple change to our working-copy
environment. Let's do something simple like capitalize the Summary field from 'Get all todos' to 'Get All Todos'. It doesn't really matter what the change is.
Save your changes. Click the GitHub button at bottom left and choose Commit & Push. Enter a description of your change in the dialog that pops up:
Click Commit & Push will create a new temporary branch in GitHub with a name zup-...
. On the next dialog, click Create Pull Request.
This will navigate you to the screen in GitHub that allows you to create a Pull Request. Change the base branch to development
(since that is the environment we want to update first). Click Create pull request.
When ready, click Merge pull request
Once merged, you'll want to delete that temporary branch.
The successful merge will trigger a rebuild and deployment of development
with your change. You can check this by choosing the environment development
in Zuplo and navigating to the readonly Route Designer.
This shows how you can use widely recognized GitOps practices to manage how code flows through your environments using Pull Requests and protected branches.