Giter Club home page Giter Club logo

docker-sinopia's Introduction

Deprecation Notice

Hi everyone, this project is no longer maintained.

Please use verdaccio/verdaccio and its official Docker Image

Sinopia (Docker Image)

Sinopia is a private npm repository server

Installing Image

docker pull keyvanfatehi/sinopia:latest

Creating Container

docker run --name sinopia -d -p 4873:4873 keyvanfatehi/sinopia:latest

Setting Registry

npm set registry http://<docker_host>:4873/

Determining Username and Password

docker logs sinopia

Modify configuration

There are two ways to modify the configuration.

To understand the difference, view the conversation here: #10

Original Method

docker stop sinopia
docker run --volumes-from sinopia -it --rm ubuntu vi /opt/sinopia/config.yaml
docker start sinopia

Alternative Method

# Save the config file
curl -L https://raw.githubusercontent.com/rlidwka/sinopia/master/conf/default.yaml -o /path/to/config.yaml
# Mount the config file to the exposed data volume
docker run -v /path/to/config.yaml:/opt/sinopia/config.yaml --name sinopia -d -p 4873:4873 keyvanfatehi/sinopia:latest

Restart the container anytime you change the config.

configure Vagrant

Setting the npm registry to http://localhost:4873 in a Dockerfile which should point to the sinopia registry locally will not work during the docker build process, since localhost:4873 references to the Docker container itself and not the host-machine where sinopia runs. With the Vagrant configuration one could locally spin up this Dockerfile in a vbox with the command vagrant up and reference this registry it in a 'target'-Dockerfile with RUN npm set registry http://10.10.10.10:4873.

# vagrant up

and in the Dockerfile of your application set

CMD npm set registry http://10.10.10.10:4873

Vagrant is open source. See install instructions for mac or *nix.

Backups

docker run --volumes-from sinopia -v $(pwd):/backup ubuntu tar cvf /backup/backup.tar /opt/sinopia

Alternatively, host path for /opt/sinopia can be determined by running:

docker inspect sinopia

Restore

docker stop sinopia
docker rm sinopia
docker run --name sinopia -d -p 4873:4873 keyvanfatehi/sinopia:latest
docker stop sinopia
docker run --volumes-from sinopia -v $(pwd):/backup ubuntu tar xvf /backup/backup.tar
docker start sinopia

Links

docker-sinopia's People

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar

docker-sinopia's Issues

Docker image size

Node:latest is 630+Mb, while Node:carbon-slim is just 230Mb.
Could it be changed?

Cross-Domain Error

I'm using the NPM Private registry which was deployed using the image model ( keyvanfatehi/sinopia:latest ). I can't use the sinopia API through ajax from another machine , it encounters the following issue ,

No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin and therefore not allowed access.

How and where the following entry to be added set Header always set Access-Control-Allow-Origin "*" .? Kindly help me to do this.

Thanks,

Kaleeswaran N

Alternative method for config change doesn't work

Hello,

I wanted to mount my own configuration like explained in the README:

docker run -v `pwd`/config.yaml:/opt/sinopia/config.yaml --name sinopia -d -p 4873:4873 keyvanfatehi/sinopia:latest

But docker logs sinopia tells me:

    module.js:340
            throw err;
                        ^
    Error: Cannot find module 'sinopia/lib/config_gen'
            at Function.Module._resolveFilename (module.js:338:15)
            at Function.Module._load (module.js:280:25)
            at Module.require (module.js:364:17)
            at require (module.js:380:17)
            at Object.<anonymous> (/opt/sinopia/config_gen.js:2:14)
            at Module._compile (module.js:456:26)
            at Object.Module._extensions..js (module.js:474:10)
            at Module.load (module.js:356:32)
            at Function.Module._load (module.js:312:12)
            at Function.Module.runMain (module.js:497:10)
    /opt/sinopia/start.sh: line 4: /opt/sinopia/config.yaml: Permission denied
    cat: /opt/sinopia/config.yaml: Permission denied
     fatal --- cannot open config file /opt/sinopia/config.yaml: EACCES, permission denied

I'm guessing this is because the config file gets mounted into the container as root, but sinopia is runningas user sinopia inside the container? How do I fix this?

Error running docker

Pull

$ docker pull keyvanfatehi/sinopia:latest

Run

$ docker run --name sinopia -d -p 4873:4873 keyvanfatehi/sinopia:latest

Check logs

$ docker logs sinopia

module.js:340
    throw err;
          ^
Error: Cannot find module 'sinopia/lib/config_gen'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/opt/sinopia/config_gen.js:2:14)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
sed: can't read /tmp/config.yaml: No such file or directory
 warn  --- config file  - /opt/sinopia/config.yaml

/opt/sinopia/node_modules/sinopia/lib/cli.js:75
  if (!config.user_agent) config.user_agent = 'Sinopia/'+pkg.version
             ^
TypeError: Cannot read property 'user_agent' of undefined
    at afterConfigLoad (/opt/sinopia/node_modules/sinopia/lib/cli.js:75:14)
    at Object.<anonymous> (/opt/sinopia/node_modules/sinopia/lib/cli.js:58:1)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/opt/sinopia/node_modules/sinopia/bin/sinopia:3:1)
    at Module._compile (module.js:456:26)

Unable to edit config.yaml as described in the documentation

Running

docker stop sinopia
docker run --volumes-from sinopia -it --rm ubuntu vi /opt/sinopia/config.yaml

results in

exec: "vi": executable file not found in $PATH
docker: Error response from daemon: Container command not found or does not exist..

Docker image is invalid due to tar arguments

I get this error when I install the docker image:

$ docker pull keyvanfatehi/docker-sinopia
Pulling repository keyvanfatehi/docker-sinopia
253ec0f60f38: Error pulling image (latest) from keyvanfatehi/docker-sinopia, Unhandled tar header type 83
...
1bd0372fde64: Error downloading dependent layers 
2014/04/11 16:04:24 Could not find repository on any of the indexed registries.

Some googling reveals this issue in docker related to bad arguments to tar in docker 0.7.3. Apparently re-creating and uploading the image should fix the issue.

Please push 0.13.0 as latest

docker build -t keyvanfatehi/docker-sinopia:latest keyvanfatehi/docker-sinopia:0.13.0

You can remove the versions from all of the instructions after doing this.

@-scoped packages not handled

I can install and publish scoped packages to a Sinopia registry but can't install scoped packages from an upstream repository (e.g. http://registry.npmjs.com/).

e.g: npm install package '@kadira/storybook'

gives a 404 error when the repository is Sinopia, but works just fine from registry.npmjs.com
Sinopia doesn't seem to handle URLs with @ scoping correctly.

start.sh error - cannot find nodejs

looks like dockerfile/nodejs has the executable named node not nodejs.

From the container logs I recieved:

/opt/sinopia/start.sh: line 8: nodejs: command not found

Error when running on kubernetes with persistent volume.

I deploy sinopia on kubernetes, with persistent volume bound to /opt/sinopia/storage. I have checked that this persistent volume is writable.

#
# This is the default config file. It allows all users to do anything,
# so don't use it on production systems.
#
# Look here for more config file examples:
# https://github.com/rlidwka/sinopia/tree/master/conf
#

# path to a directory with all packages
storage: ./storage

auth:
  htpasswd:
    file: ./htpasswd
    # Maximum amount of users allowed to register, defaults to "+inf".
    # You can set this to -1 to disable registration.
    #max_users: 1000

# a list of other known repositories we can talk to
uplinks:
  npmjs:
    url: https://registry.npmjs.org/

packages:
  '@*/*':
    # scoped packages
    access: $all
    publish: $authenticated

  '*':
    # allow all users (including non-authenticated users) to read and
    # publish all packages
    #
    # you can specify usernames/groupnames (depending on your auth plugin)
    # and three keywords: "$all", "$anonymous", "$authenticated"
    access: $all

    # allow all known users to publish packages
    # (anyone can register by default, remember?)
    publish: $authenticated

    # if package is not available locally, proxy requests to 'npmjs' registry
    proxy: npmjs

# log settings
logs:
  - {type: stdout, format: pretty, level: http}
  #- {type: file, path: sinopia.log, level: info}

listen:
  - 0.0.0.0:4873
 warn  --- config file  - /opt/sinopia/config.yaml
fs.js:549
  return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
                                                  ^

Error: EACCES: permission denied, open '/opt/sinopia/storage/.sinopia-db.json'
    at Error (native)
    at Object.fs.openSync (fs.js:549:18)
    at Object.fs.writeFileSync (fs.js:1161:15)
    at LocalData.sync (/opt/sinopia/node_modules/sinopia/lib/local-data.js:42:6)
    at Config (/opt/sinopia/node_modules/sinopia/lib/config.js:49:22)
    at module.exports (/opt/sinopia/node_modules/sinopia/lib/index.js:14:17)
    at afterConfigLoad (/opt/sinopia/node_modules/sinopia/lib/cli.js:100:13)
    at Object.<anonymous> (/opt/sinopia/node_modules/sinopia/lib/cli.js:63:1)
    at Module._compile (module.js:434:26)
    at Object.Module._extensions..js (module.js:452:10)

Permission issues with mounting volume in docker

I am using docker container for Sinopia (Tag: 0.13.0). I used the below command to run the container

docker run -name sinopia -d -p 4873:4873 -v /npm/sinopia/storage:/opt/sinopia/storage keyvanfatehi/sinopia:0.13.0

And when I tried to install some npm packages, it gives the below error:-

Error: EACCES, mkdir '/opt/sinopia/storage/fresh'
http <-- 500, user: undefined, req: 'GET /fresh', error: internal server error

Inorder to work, I need to give full permission for the mount directory ie (/npm/sinopia/storage)
how can we avoid this ?? I dont want to give full permission.

Does not seem to generate the config by default

I followed the instructions in docker hub to install sinopia latest in a centos container and get the following:

docker@npm:~$ docker logs sinopia

module.js:340
    throw err;
          ^
Error: Cannot find module 'sinopia/lib/config_gen'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/opt/sinopia/config_gen.js:2:14)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
sed: can't read /tmp/config.yaml: No such file or directory
 warn  --- config file  - /opt/sinopia/config.yaml

/opt/sinopia/node_modules/sinopia/lib/cli.js:75
  if (!config.user_agent) config.user_agent = 'Sinopia/'+pkg.version
             ^
TypeError: Cannot read property 'user_agent' of undefined
    at afterConfigLoad (/opt/sinopia/node_modules/sinopia/lib/cli.js:75:14)
    at Object.<anonymous> (/opt/sinopia/node_modules/sinopia/lib/cli.js:58:1)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/opt/sinopia/node_modules/sinopia/bin/sinopia:3:1)
    at Module._compile (module.js:456:26)

Bump for 1.0.0 alphas?

Although 1.0.0 proper isn't out yet, it'd be awesome if the alpha releases could be tracked for the time being to make upgrading easier.

Dockerhub: latest tag

Why is the latest tag so much smaller in Dockerhub compared to all the other tags,
even the tag with highest version number - improved build?

Default config.yaml in Docker Description is incomplete

The Alternate method to get a config file on the Docker registry page (https://hub.docker.com/r/keyvanfatehi/sinopia/) points to this url: https://github.com/rlidwka/sinopia/blob/master/conf/default.yaml

This config file is missing the listen: directive. So if the docker container is started up with this config file, sinopia inside the container starts up listening on localhost:4873. Now even if the port forwarding is added from the host to the container, the app itself in not listening on the right interface. Ideally the default config should also have this added

listen:
  - 0.0.0.0:4873

OR
Update the docker description to point to the config.yaml in this repo.

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.