Giter Site home page Giter Site logo

citizen's Introduction

Citizen

Build Status FOSSA Status Dependency Status devDependency Status

A Private Terraform Module Registry in the early stages of development.

Requirements

  • Node.js 8+

  • HTTPS - Terraform module registry only support HTTPS.

Usage

citizen server

To launch the registry server

$ ./citizen server

It will be launched at http://localhost:3000. You can check it at http://localhost:3000/health.

Because Terraform CLI works with only HTTPS server, you should set up HTTPS in front of the registry server.

If you want to test it at local, you need a tool which provides HTTPS like ngrok.

Environment variables:

  • CITIZEN_DATABASE: Backend provider for registry metadata. Set to mongodb to use MongoDB. Leaving unset will use local nedb file.

  • CITIZEN_MONGO_DB_URI: MongoDB database URI if using MongoDB backend. URI format is mongodb://username:password@host:port/database?options…​. Default is mongodb://localhost:27017/citizen

  • CITIZEN_DATA_PATH: A directory to save database file if using local backend storage. The default is data directory in a current working directory (absolute/relative path can be used).

  • CITIZEN_STORAGE : Storage type to store module files. You can use file or s3 type.

  • CITIZEN_STORAGE_PATH: A directory to save module files only if CITIZEN_STORAGE is file (absolute/relative path can be used).

  • CITIZEN_AWS_S3_BUCKET`: A S3 bucket to save module files only if CITIZEN_STORAGE is s3.

  • AWS_ACCESS_KEY_ID: Your AWS access key only if CITIZEN_STORAGE is s3.

  • AWS_SECRET_ACCESS_KEY: Your AWS secret access key only if CITIZEN_STORAGE is s3.

citizen publish

Since official Terraform Module Registry is integrated with GitHub, users can publish terraform modules if they just push it on GitHub.

Citizen provides a special command to publish a module onto citizen registry server instead integrating GitHub.

In a module directory, you can publish your terraform module via a command below:

$ ./citizen publish <namespace> <name> <provider> <version>

You should set CITIZEN_ADDR as citizen registry server address which you will publish your modules to. e.g. https://registry.example.com.

Examples

If you have ALB module in ./alb directory and your registry server is launched at https://registry.example.com, you run below command in ./alb directory to publish ALB module.

$ CITIZEN_ADDR=https://registry.example.com \
  citizen publish dev-team alb aws 0.1.0

Then, you can define it in your terraform file like this:

module "alb" {
  source = "registry.example.com/dev-team/alb/aws"
  version = "0.1.0"
}

Docker

You can use docker to launch the registry server. The docker image is in outsideris/citizen.

$ docker run -d -p "3000:3000" outsideris/citizen:latest

Development

Set environment variables, see above.

$ ./bin/citizen server
$ ./bin/citizen publish

Test

Set at least a storage path and the s3 bucket name variables for the tests to succeed. You need to be able to access the bucket, so you probably want to have an active aws or aws-vault profile.

Run mongodb first like:

$ docker run -p 27017:27017 --name mongo mongo

Run the tests:

$ npm test

Run the tests with the environment variables prefixed:

$ CITIZEN_STORAGE_PATH=storage CITIZEN_AWS_S3_BUCKET=terraform-registry-modules npm test

Build distributions

$ npm run build

Under dist/, citizen binaries for linux, darwin and windows made.

License

FOSSA Status

citizen's People

Contributors

fossabot avatar johnkeates avatar outsideris avatar robburger avatar

Watchers

 avatar

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.