Instructions for deploying a Battlesnake on IBM Cloud
Credit goes to the Node.js Starter Battlesnake for instructions on how to register your battlesnake. And to Colin Walker for his tutorial https://colinjfw.github.io/battlesnake-learn/ that extended the starter BattleSnake.
This repo contains instructions on how to deploy your Battlesnake to IBM Cloud.
- Battlesnake Account
- IBM Cloud Account
- GitHub Account (Optional)
Running Your Battlesnake on IBM Cloud
-
Login to your IBM Cloud account.
-
Launch the IBM Cloud Shell, which is available by clicking on the terminal icon on the top right.
-
Once loaded, you'll be presented with an embedded web terminal that has the
ibmcloud
CLI and other tools available. -
Clone this repo so we have the source code we want to deploy. Copy the following command into the terminal
git clone https://github.com/IBM/starter-snake-node
and navigate into the directory of the cloned repository
cd starter-snake-node
-
To deploy the application with Cloud Foundry we first we need to target a Cloud Foundry API endpoint. To do this, run the following interactive command.
ibmcloud target --cf
You should see output like the example below:
$ ibmcloud target --cf Targeted Cloud Foundry (https://api.us-south.cf.cloud.ibm.com) Targeted org stevemar@ibm.com Targeted space dev API endpoint: https://cloud.ibm.com Region: us-south User: stevemar@ibm.com Account: Steve Martinelli Account Resource group: default CF API endpoint: https://api.us-south.cf.cloud.ibm.com (API version: 2.152.0) Org: stevemar@ibm.com Space: dev
-
We can now deploy our application with
cf push
.ibmcloud cf push
You should see output like the example below:
$ ibmcloud cf push Invoking 'cf push'... Using manifest file /home/stevemar/node-hello-world/manifest.yml ... Creating app starter-snake-node... ... name: starter-snake-node requested state: started routes: starter-snake-node-surprised-kudu-ec.mybluemix.net last uploaded: Mon 14 Sep 13:46:54 UTC 2020 stack: cflinuxfs3 buildpacks: sdk-for-nodejs type: web instances: 1/1 memory usage: 64M
-
To access the application navigate to the URL that is show in the
routes
value, in the example above it is:https://starter-snake-node-surprised-kudu-ec.mybluemix.net
If all goes well - you should see text similar to this:
{"apiversion":"1","author":"stevemar","color":"#00ff00","head":"default","tail":"default"}
This means your Battlesnake is running correctly on IBM Cloud.
At this point your Battlesnake is live and ready to enter games!
-
Sign in to play.battlesnake.com.
-
Go here to create a new Battlesnake. Give it a meaningful name and complete the form using the URL for your Repl from above.
-
Once your Battlesnake has been saved you can create a new game and add your Battlesnake to it. Type your Battlesnake's name into the search field and click "Add" to add it to the game. Then click "Create Game" to start the game.
-
You should see a brand new Battlesnake game with your Battlesnake in it! Yay! Press "Play" to start the game and watch how your Battlesnake behaves.
-
Feel free to fork this repo and repeat the steps from the above section to point to your own repository instead of this one.
At this point you should have a registered Battlesnake and be able to create games!
For more information check out the Node.js Starter Battlesnake.