Coder Social home page Coder Social logo

deploy-unity's Introduction

deploy-unity

Deploy your Unity WebGL game to Amazon's Elastic Container Service using this handy-dandy virtual environment.

How to Deploy Unity Builds

Dependencies

  • aws-cli
  • ecs-cli
  • jq

Things you need:

  • a domain (guide)
  • a TLS certificate (guide)
  • an ECS cluster (guide) and service (guide)
    • name your service with the name you will set in config.json
    • recommended: set your service behind an ALB (guide)

Create a CNAME under your domain that points to the ALB (guide). Use the TLS certificate to encrypt the traffic between the client and the ALB (guide). Then configure a target group to forward traffic to your service's tasks (guide). This tool doesn't touch on any of these things, but you should have this setup before hosting a game.

Last thing to note is to ensure that the ECS task role you use have ecr:* and logs:* permissions. It doesn't have to be that open, but ¯\_(ツ)_/¯.

Configuration

Before you begin, be sure to have aws-cli and ecs-cli configured. If you don't already, follow this guide for aws-cli, and this guide for ecs-cli.

Once that's done, the first thing you need to do is fill out config.json:

  • build_dir: build directory (where you built to from Unity)
  • name: the name for your ECR repository, task definition, and service
  • tag: tag your deploy (usually "latest")
  • cluster: name of your cluster
  • network_mode: bridge, host, awsvpc, or none
  • task_role_arn: role arn the containers will assume
  • execution_role_arn: role arn that container agents and docker daemon will assume
  • network_mode: bridge, host, awsvpc, or none (not implemented, uses default)
  • cpu: CPU units
  • memory: MiB units

Deploying

Reminder: you must have a cluster and service ready before deployment.

If you're ready to go, here are the steps:

  • In Unity:
    • click File>Build Settings...
    • click WebGL
    • configure your build
    • click Build and choose this repo as the destination
  • Here:
    • run . deploy_env.sh
    • run deploy
    • when done, run deactivate

deploy will:

  • login to ECR
  • build the docker image (./Dockerfile)
  • push the image to ECR
  • create a new task definition revision
  • update the service with the new task definiton

While in the deploy environment, you can:

  • ecr-login: login to ECR
  • build: build the local docker image
  • push: push image (takes name from config.json.name) to ECR
  • revise: create new task definition revision
  • update: update the service with the new task definition
  • deactivate: deactivate deploy environment

That's the basic flow of things. You can always version control your builds and use this in something like Jenkins.

deploy-unity's People

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

marengaz

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.