Giter VIP home page Giter VIP logo

npmo-docker-compose's Introduction

npmo-docker

A docker setup for npmo, split into three main components:

  • couchdb
  • registry
  • web

Note: Only works locally, very WIP.

Requirements

  • Install the Docker Toolbox, create a machine.
  • Make sure you have the latest version of the docker engine and docker compose.
  • Optional Node.js/NPM install

License Setup

Install with Node.js/NPM

If you have node.js installed in your environment, then you can setup as follows:

$ npm install
$ npm run configure

Install with Docker

  • Direct Internet access

If your host has access to the internet and registry.npmjs.com.

$ docker build -t configure -f ./Dockerfile.configure .
  • Behind the HTTP_PROXY
$ docker build --build-arg HTTP_PROXY=$HTTP_PROXY -t licensesetup -f ./Dockerfile.configure .

Run Configuration

$ docker run --name license_verify -ti --rm -e HTTP_PROXY=$HTTP_PROXY licensesetup bash
root@050a2795bc15:/usr/src/app#

At this point, you are placed at the container terminal where you can run npm run configure to setup the license.

root@050a2795bc15:/usr/src/app# npm run configure
npm info it worked if it ends with ok
npm info using [email protected]
npm info using [email protected]
npm info preconfigure [email protected]
npm info configure [email protected]

> [email protected] configure /usr/src/app
> ./bin/npme-docker-compose.js configure

? enter your billing email TYPE_YOUR_EMAIL
? enter your license key PASTE_YOUR_LICENSE
? the full front-facing URL of your registry REGISTRY_URL
? proxy URL for outbound requests (optional) HTTP_PROXY
\o/ you can now go ahead and run `npm run up`
npm info postconfigure [email protected]
npm info ok

After you finish, you can detach from the container pressing CTRL+P and CTRL+Q.

Copy License

You confirm and copy the license.

$ docker diff license_verify
C /usr
C /usr/src
C /usr/src/app
C /usr/src/app/roles
C /usr/src/app/roles/registry
C /usr/src/app/roles/registry/files
A /usr/src/app/roles/registry/files/.license.json
A /usr/src/app/.env
D /usr/src/app/npm-debug.log

$ docker cp license_verify:/usr/src/app/roles/registry/files/.license.json roles/registry/files/

This will copy the license to the appropriate directory. You can now run the services!

$ docker-compose up

This will start the docker instances.

You should now be able to login:

$ npm login --registry=http://$(docker-machine ip $DOCKER_MACHINE_NAME):8080 --scope=local

npmo-docker-compose's People

Contributors

bcoe avatar marcellodesales avatar tgvashworth avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

npmo-docker-compose's Issues

Requirements + Design

My primary goal is getting this running on our infra, so I thought it would be useful to be clear about what the requirements are so we can make sure it works for that use case.

  • The deployment is split across a several machines
  • I need to be able to configure and deploy different groups of components independently, and configure them to point at the other machines
  • The machines have docker (therefore not node, npm or docker-compose)

roles

We're splitting the deployment into three roles (2 or more machines per role, in multiple data centers): web, registry and couchdb

registry

  • auth
  • frontdoor
  • nginx
  • redis
  • validate

couchdb

2+ machines, configured as single primary with read-only secondaries.

web

  • postgres
  • rrfollower
  • rrservice
  • newww
  • elasticsearch
  • esfollower
  • policyfollower

in operation

Ideally, I need to be able to run two commands per box:

  • configure (choose components, identify external hosts, primary/secondary config, replication, etc)
  • start

The main thing I don't believe we have right now is the 'choose components' step. My thinking is that this is achievable with:

  • a per-role docker-compose file
  • a configure step that builds the .env file for that role

What do you think?

Can't build behind the firewall

Hi guys

So I took a stab on this and I found out we cannot build behind the firewall/proxy...

Building tools
Step 1 : FROM node:4.2.2
4.2.2: Pulling from library/node
Digest: sha256:58be9ba95a26b84e313238448ee67d1d28f7c77b8612dbfb741cbc85326d0f57
Status: Downloaded newer image for node:4.2.2
 ---> 59997ac87b31
Step 2 : RUN mkdir -p /usr/workdir
 ---> Running in b2a4d3510756
 ---> 187bc384a09f
Removing intermediate container b2a4d3510756
Step 3 : WORKDIR /usr/workdir
 ---> Running in b5e65599bc0f
 ---> d22118d47634
Removing intermediate container b5e65599bc0f
Step 4 : COPY files /usr/workdir
 ---> 532b00205719
Removing intermediate container 9102452bf0dc
Step 5 : RUN npm install
 ---> Running in 8fff33fe542b
npm info it worked if it ends with ok
npm info using [email protected]
npm info using [email protected]
npm WARN package.json npmo-docker-tools@ No repository field.
npm WARN package.json npmo-docker-tools@ No README data
npm info preinstall npmo-docker-tools@
npm info attempt registry request try #1 at 10:56:48 PM
npm http request GET https://registry.npmjs.org/babel
npm info attempt registry request try #1 at 10:56:48 PM
npm http request GET https://registry.npmjs.org/babel-cli
npm info attempt registry request try #1 at 10:56:48 PM
npm http request GET https://registry.npmjs.org/babel-preset-es2015
npm info attempt registry request try #1 at 10:56:48 PM
npm http request GET https://registry.npmjs.org/babel-preset-stage-1
npm info attempt registry request try #1 at 10:56:48 PM
npm http request GET https://registry.npmjs.org/node-fetch
npm info retry will retry, error on last attempt: Error: connect ETIMEDOUT 23.235.47.162:443
npm info retry will retry, error on last attempt: Error: connect ETIMEDOUT 23.235.47.162:443
npm info retry will retry, error on last attempt: Error: connect ETIMEDOUT 199.27.79.162:443
npm info retry will retry, error on last attempt: Error: connect ETIMEDOUT 199.27.79.162:443
npm info retry will retry, error on last attempt: Error: connect ETIMEDOUT 23.235.47.162:443

The reason why is that the HTTP_PROXY is not propagated to the docker build command, which now supports a new argument --build-arg. Could this image be fetched from the Hub instead of building? If so, we would just use the environment variable HTTP_PROXY without a problem.

The feature for adding --build-arg is still open docker/compose#2111 (comment).

Split config

I'm working on up the component's config on the split-config branch. I'm hacking it together at the moment to figure out the best approach, so it's all one commit. Not ideal, sorry.

Todo:

  • Split config into distinct components (web, registry, couchdb)
  • Generate env file for components that need to communicate
  • Build tool to run components in simultaneously or independently

The goal is to support running npmo on one box or on several, all configurable, as per #10.

Consolidate environment info on single .env to fix docker-compose 1.5.1 failures

Hi guys

I have all my environments upgraded to docker-compose 1.5.1.

[root@pppdc9prda2x npmo-docker-compose]# docker-compose version
docker-compose version: 1.5.1
docker-py version: 1.5.0
CPython version: 2.7.9
OpenSSL version: OpenSSL 1.0.1e 11 Feb 2013

This version is validating the compose file and it is failing on the environments section.

[root@pppdc9prda2x npmo-docker-compose]# docker-compose run
ERROR: Validation failed in file './docker-compose.yml', reason(s):
Service 'auth' configuration key 'environment' contains non unique items, please remove duplicates from ['AUTHENTICATION_METHOD=fake', 'AUTHORIZATION_METHOD=fake', 'GITHUB_HOST=', 'GITHUB_ORG=', 'LOGIN_CACHE_REDIS=redis://redis:6379', 'REJECT_UNAUTHORIZED=0', 'SESSION_HANDLER=redis', 'SESSION_HANDLER=redis', 'SHARED_FETCH_SECRET=a
  • Have you guys run into this?
  • Maybe a big .env file would help, since all the environments should be there instead of in multiple containers?

Workaround

I removed all the environments from the docker-compose.yml to the auth.env file, and completely removed the environments section from the auth service.

auth service

auth:
  expose:
    - "5000"
  env_file: .auth-env
  image: bcoe/npm-auth-ws:1.0.6
  links:
    - redis
  restart: always

.auth-env

[root@pppdc9prda2x npmo-docker-compose]# cat .auth-env
AUTHENTICATION_METHOD=fake
AUTHORIZATION_METHOD=fake
GITHUB_HOST=
GITHUB_ORG=
LOGIN_CACHE_REDIS=redis://redis:6379
REJECT_UNAUTHORIZED=0
SESSION_HANDLER=redis
SESSION_HANDLER=redis
SHARED_FETCH_SECRET=abc123
FRONT_DOOR_HOST=http://npmjs.intuit.net
PROXY_URL=http://qypprdproxy02.ie.intuit.net:80

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.