Getting Started with DigitalOcean and Battlesnake
Check out this quick start guide to help you get started with building your first Battlesnake using the DigitalOcean App platform.

Are you new to Battlesnake, or just looking to try out a new technology stack?
Then be sure to check out this quick start guide to help you get started with building your first Battlesnake using the DigitalOcean App platform.
For this guide you will need the following accounts:
- A free GitHub Account
- A free Battlesnake Account
- A DigitalOcean Account

Step 1
Setup Your GitHub Repository
To begin, head over to the Battlesnake Python Starter Snake repository on GitHub, log-in, then select the green "Use this template" button.

As with any GitHub repository, choose an memorable and appropriate name (i.e. digitalocean-battlesnake) and whether you would like the code to be Public/Private, then select the "Create repository from template" button at the bottom of the screen.

Step 2
Authorize the DigitalOcean GitHub Application
Next head over to your DigitalOcean dashboard, and click the green "Create" drop-down button in the top navigation bar and select "Apps".
Alternatively, you can select "Apps" from the sidebar menu and then select the blue "Create App" button in the main window.

Once you have successfully accessed the App creation screen in the DigitalOcean dashboard, select the source for your Battlesnake code, which in our case will be the GitHub repository that you created earlier.

After selecting "GitHub" you will either be immediately redirected to GitHub to Install and Authorize the DigitalOcean app (see first image below), or you may be prompted with the following:
"Sorry, we're having trouble finding your repos. Please check your authorizations for this service."
If you receive the above prompt, select "Manage Authorization" and you should be redirected to the "Install & Authorize DigitalOcean" page.


After the authorization process is complete, you should be redirected back to the DigitalOcean App creation page where you began, as seen below.
Once here, select the relevant repository on your GitHub account, the branch you would like to deploy (i.e. main), and check the "Autodeploy" box to enable CI/CD when you push changes to your selected branch.

After clicking next, you will be presented with the "Configure your app" settings which will automatically populate based on the chosen Starter Snake.
You will then need to choose your web service "Name" and "Region" in order to move forward to the final stage of the App creation process.


The final stage of launching your Battlesnake with the DigitalOcean App Platform will be to select a plan and container size.
With that $100 in credits you can feel free to max out your app settings, but to get started with this tutorial you can also choose the basic settings:
- Plan: Basic
- Containers: 1 @ $5.00/mo (512 MB RAM | 1 vCPU)
Once you have selected the plan and container sizes, click the blue "Launch Basic App" button at the bottom of the screen to start the deployment.

After launching your app, you should be redirected to the main DigitalOceans App Platform dashboard where you will see the following prompt:
It will take a few minutes (up to 10), but if everything goes according to plan you should eventually see a prompt which reads:


Once you see the above prompt, either select the URL provided below your app name (i.e. ending in .ondigitalocean.app), or select the "Live App" button, and you should see something similar to what is found below.

Step 3
Register your New DigitalOcean Battlesnake
Once you have setup your Battlesnake Web Server on the Digital Ocean App Platform and confirmed the server is live, the final step is to head over to play.battlesnake.com/account/snakes/create and add the new Battlesnake to your account (ensuring to add the "DigitalOcean" tag).

What's Next?
Looking to make changes to your Battlesnake? If you selected "Autodeploy" in Step 2 you just need to push to the "main" branch of your GitHub repository and the DigitalOcean integration will re-deploy your changes!
Looking to extend how you are using DigitalOcean for Battlesnake development? Stay tuned to the Battlesnake Blog and Social Media for more ways to use DigitalOcean throughout the 2022 Competitive Season.
