Giter Site home page Giter Site logo

svcenv's Introduction

svcenv

Utility for setting up Life.io service environments.

Installation

# Global
$ npm install -g @lifeio/svcenv

# Local
$ npm install @lifeio/svcenv (run with npx)

Usage

This utility is primarily intended for use with ECS task definitions to initialize a microservice container.


  Usage: svcenv [OPTIONS] ServiceName SecretId [outputDir]
  
  Options:
      -e,  --envFile      Name of envFile to dump in outputDir (default = ./.env)
      -h,  --help         Display help screen
      -p,  --profile      If using local ~/.aws credentials
      -r,  --region       Region to use for secrets lookup
      -v,  --version      Display version

Environment

It will pull secrets stored in AWS Secerets Manager under the SecretId key and dump them to an env file (default=./.env).

NODEID

The utilty will add a NODEID to the created .env file as well, using the following rules:

  1. If it detects a NODEID from the current environment, this value will be written to the file as is.
  2. If it finds the variable ECS_CONTAINER_METADATA_URI in the environment it will download the meta data and create a NODEDID using the ServiceName command line argument and the first eight characters of the ECS Task Id.
  3. If the ECS_CONTAINER_METADATA_URI variable is not present OR there is an error extracting the Task Id, NODEID will be ServiceName-Date.now-5 digit random number.

S3 DEPLOYMENT BUCKET

If the variable LIFEIO_DEPLOYMENT_BUCKET is found in the process env or the AWS Secret Manager env, it will be used to download the contents of the bucket to the outputDir (./).

IMPORTANT - The LIFEIO_DEPLOYMENT_BUCKET variable must be formatted s3://[bucket]/[keyPrefix].

AWS Authentication

The utility can authenticate via IAM, or if running outside of AWS via authentication env vars, or it will use the ~/.aws/credentials file. If using the credentials file, the --profile argument can be used to select the correct profile.

DEBUGGING

The utilty uses the debug module. To turn on debugging add DEBUG=* to the command line or your environment.

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.