This repo is to store all of unbounce's battlesnakes along with common infrastructure to deploy them. You don't have to use this repo to play battlesnake but it can be helpful to get a quick start into the game.
-
Copy the folder
snakes/_template
and give it a name of your snake. The name should be URL friendly, ie. no spaces or slashes etc. This folder will contain all the source code to run your battlesnake API stack.- eg:
cp -r snakes/_template snakes/my-snake-name
- eg:
-
Set snake name env var. This will make life easier later when running makefile commands
export SNAKE_NAME=my-snake-name
-
Edit the
vars.yaml
file in your snake's folder- set the snake
name
to match your snake's folder name - Set
owner
to you or your team's name. - Check the
port
number configured matches what your API will use - Use recommended
resources
block unless you find your snake pod needs more/less
- set the snake
-
Edit the
Dockerfile
to work with your language stack -
Add in your source code and get to work!
If you've exported your snake's name to the SNAKE_NAME
var, you can use these make commands without specifying the SNAKE_NAME=my-snake-name
before each make command.
make build
This will use the Dockerfile
in your snake's folder to build and tag an image as :snake-name-<githash>
make release
This will push your tagged docker image to the shared battlesnake ECR repo so it can be used by kubernetes
make deploy
This will deploy your battlesnake to the kubernetes cluster so it can respond to incoming game requests. All battlesnakes share one loadbalancer but they have individual urls. URL will be
<snake-name>-eks-integration.us-west-2.legacy.unbounce.net
- Head to https://play.battlesnake.com/ and create an account
- Once logged in you can go to your profile and look for
battlesnakes
- Here you can register a new snake endpoint url to use for your games
- Next hit Play Game to start a game and add your battlesnake
- Optionally: Add other peoples' snakes that are public using their battlesnakeUserName/battlesnake-name
- Watch your snakes performance, tweak and redploy.
See https://docs.battlesnake.com/ for details on how the game works and the structure of their API and objects.
Feel free to make any changes to files within your snake's subfolder. You don't need PR approval for anyone else, it's your space.
For shared resources in the infrastructure folder, get core to review your PR because these will effect all of the deployed battlesnakes.