Thanks to visit codestin.com
Credit goes to github.com

Skip to content

mirage (github.com/acidlemon/mirage) for Amazon ECS

Notifications You must be signed in to change notification settings

fujiwara/mirage-ecs

 
 

Repository files navigation

mirage-ecs - reverse proxy frontend for Amazon ECS

mirage-ecs is reverse proxy for ECS task and task manager.

mirage-ecs can run and stop ECS task and serve http request with specified subdomain. Additionaly, mirage passes variable to containers in task using environment variables.

Usage

  1. Setup mirage-ecs and edit configuration (see Setup section for detail.)
  2. Run mirage-ecs on ECS cluster.

Following instructions use below settings.

host:
  webapi: docker.dev.example.net
  reverse_proxy_suffix: .dev.example.net
listen:
  HTTP: 80

Prerequisite: you should resolve *.dev.example.net to your ECS task.

Requirements

mirage-ecs requires ECS Long ARN Format for tagging tasks.

If your account do not enable these settings yet, you must enable that.

$ aws ecs put-account-setting-default --name taskLongArnFormat --value enabled

Using CLI

  1. Launch ECS task container using curl.
curl http://docker.dev.example.net/api/launch \
  -d subdomain=cool-feature \
  -d branch=feature/cool \
  -d taskdef=myapp
  1. Now, you can access to container using "http://cool-feature.dev.exmaple.net/".

  2. Terminate the task using curl.

curl http://docker.dev.example.net/api/terminate \
  -d subdomain=cool-feature

subdomain supports wildcard (e.g. www*,foo[0-9], api-?-test). Mirage matches the pattern to hostname using Go's path/#Match.

Using Web Interface

  1. Access to mirage web interface via "http://docker.dev.example.net/".
  2. Press "Launch New Task".
  3. Fill launch options.
  • subdomain: cool-feature
  • branch: feature/cool
  • taskdef: myapp
  1. Now, you can access to container using "http://cool-feature.dev.exmaple.net/".
  2. Press "Terminate" button.

Customization

mirage-ecs now supports custom parameter. Write your parameter on config.yml.

mirage-ecs contains default parameter "branch" as below.

parameters:
  - name: branch
    env: GIT_BRANCH
    rule: ""
    required: true

You can add custom parameter. "rule" option is regexp string.

Setup

In docker/ directory,

  1. Edit config.yml to your environment.
  2. Do make to create a docker image.
  3. Push the image to ECR.
  4. Put mirage-ecs task definition to ECS.
  5. Run mirage-ecs service in your ECS.

License

The MIT License (MIT)

(c) 2019 acidlemon. (c) 2019 KAYAC Inc. (c) 2019 fujiwara.

About

mirage (github.com/acidlemon/mirage) for Amazon ECS

Resources

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published

Languages

  • Go 81.9%
  • HTML 12.8%
  • Makefile 3.4%
  • Dockerfile 1.9%