{"id":15714204,"url":"https://github.com/nbw/battlesnake-elixir","last_synced_at":"2025-04-19T18:22:07.092Z","repository":{"id":73291649,"uuid":"118087111","full_name":"nbw/battlesnake-elixir","owner":"nbw","description":"Basic Battlesnake template written in Elixir for Heroku deployment","archived":false,"fork":false,"pushed_at":"2018-01-22T02:53:34.000Z","size":94,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-29T11:34:37.837Z","etag":null,"topics":["ai","battlesnake","elixir","game","programming-contests"],"latest_commit_sha":null,"homepage":"","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nbw.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-01-19T06:35:06.000Z","updated_at":"2022-09-22T19:06:27.000Z","dependencies_parsed_at":null,"dependency_job_id":"dc159988-fd92-4c8f-9a07-ec582a9f1c54","html_url":"https://github.com/nbw/battlesnake-elixir","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nbw%2Fbattlesnake-elixir","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nbw%2Fbattlesnake-elixir/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nbw%2Fbattlesnake-elixir/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nbw%2Fbattlesnake-elixir/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nbw","download_url":"https://codeload.github.com/nbw/battlesnake-elixir/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249761792,"owners_count":21321858,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","battlesnake","elixir","game","programming-contests"],"created_at":"2024-10-03T21:35:01.140Z","updated_at":"2025-04-19T18:22:07.061Z","avatar_url":"https://github.com/nbw.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Battlesnake Elixir\n\nA basic setup for an Elixir Battlesnake with instructions for how to deploy on Heroku. Fork this repo and go wild. \n\n![elixir_phoenix_heroku](https://image.ibb.co/kwjiGw/elixir_phoenix_heroku.jpg)\n\n* uses Phoenix framework with default postgres setup (even though you probably won't use it)\n* default brunch asset settings as well\n\n**Setup difficulty:** intermediate\n\nI'm assuming that you know a bit of Elixir. \n\n# What you get\n\n* two POST endpoints `/start` and `/move` already defined\n* landing page at `/`\n\nRelevant files:\n\n* [Router](https://github.com/nbw/battlesnake-elixir/blob/master/lib/battlesnake_elixir_web/router.ex)\n* [Game Controller](https://github.com/nbw/battlesnake-elixir/blob/master/lib/battlesnake_elixir_web/controllers/game_controller.ex) and [View](https://github.com/nbw/battlesnake-elixir/blob/master/lib/battlesnake_elixir_web/views/game_view.ex)\n* Very basic [Game module](https://github.com/nbw/battlesnake-elixir/blob/master/lib/battlesnake_elixir/game/game.ex) file\n\n\n\n# What you'll need\n* Elixir 1.6 installed\n* Erlang installed (I'm using Erlang version 20)\n\nI strongly suggest using a version manager:\n\n## ASDF Version Manager (optional)\n\n1. Install ASDF\n2. Install ASDF-Elixir\n3. Install ASDF-Erlang (if you need it)\n\nhttps://github.com/asdf-vm/asdf\nhttps://github.com/asdf-vm/asdf-elixir\nhttps://github.com/asdf-vm/asdf-erlang\n\n# Running locally for the first time\n\n  1. Install dependencies with `mix deps.get`\n  2. Create and migrate your database with `mix ecto.create \u0026\u0026 mix ecto.migrate`\n  3. Install Node.js dependencies with `cd assets \u0026\u0026 npm install`\n  4. Start Phoenix endpoint with `mix phx.server`\n\nNow you can visit [`localhost:4000`](http://localhost:4000) from your browser.\n\n# Deploying on Heroku\n\nI'm most or less summarizing what's mentioned [here](https://hexdocs.pm/phoenix/heroku.html).\n\n1. [Sign up for Heroku](https://signup.heroku.com/)\n\n2. [Install the Heroku CLI](https://devcenter.heroku.com/articles/heroku-cli)\n\n3. Create a new Heroku app\n\n4. Link your repo to the app through the command line:\n  `heroku git:remote -a [YOUR APP NAME]`\n\n5. Set the buildpack through the command line: \n  `heroku buildpacks:set https://github.com/HashNuke/heroku-buildpack-elixir.git`\n\n6. Set the static buildpack through the command line (optional, but in this case we'll use it): \n  `heroku buildpacks:add https://github.com/gjaldon/heroku-buildpack-phoenix-static.git`\n\n7. There are a few environment variables you'll need to create (via command line or your app's settings page):\n * `heroku addons:create heroku-postgresql:hobby-dev`\n * `heroku config:set POOL_SIZE=18`\n * (optional) `heroku run \"POOL_SIZE=2 mix [YOUR APP NAME].task\"` Note: you need to insert your app name\n * generate a secret via: `mix phx.gen.secret` then `heroku config:set SECRET_KEY_BASE=\"[THE SECRET GOES HERE]\"`\n\nThis is what it should look like in your Heroku settings page (with different values):\n![heroku settings](https://image.ibb.co/npRNbw/Screenshot_2018_01_21_17_28_11.png)\n\n8. In your `config/prod.exs` file change this line:\n    `url: [scheme: \"https\", host: \"battlesnake-elixir.herokuapp.com\", port: 443],`\n  to the url of your heroku app. \n\n9. Commit all your changes in git, and push to heroku: `git push heroku master`\n\n## Warnings about Heroku\nSince you're using a free hobby app, your app will fall asleep when inactive. Make sure it's awake by hitting its URL before you play a game. This will normally happen in a game when you receive a `/start` request. After that you should be fine. \n\n# Questions?\n\nYou'll find me in the YYJ Tech Slack channel or in a million other places. \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnbw%2Fbattlesnake-elixir","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnbw%2Fbattlesnake-elixir","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnbw%2Fbattlesnake-elixir/lists"}