Sinopia is a private npm repository server. This is a fork of keyvanfatehi/sinopia, tuned for the Zanata team.
This service uses data volume, thus requires docker >= 1.9.0. Fedora >= 23 and latest RHEL 7 have this capability.
If you are using Fedora Atomic Host, just use:
atomic install sinopia
- Pull zanata/sinopia2 image
docker pull docker.io/zanata/sinopia2
- Create sinopia user at host
getent passwd sinopia >/dev/null || sudo useradd -G docker sinopia
- Download
sinopia.yaml
sudo curl -o ~sinopia/sinopia.yaml https://raw.githubusercontent.com/zanata/zanata-sinopia-docker-files/master/sinopia.yaml
- Download
sinopia.service
sudo curl -o /etc/systemd/system/sinopia.service https://raw.githubusercontent.com/zanata/zanata-sinopia-docker-files/master/sinopia.service
- Setup systemd
sudo systemctl daemon-reload && sudo systemctl enable sinopia
sudo systemctl start
Setting NPM Registry:
npm set registry http://${DOCKER_HOST}:${HOST_PORT}/
For examples, use:
npm set registry http://localhost:4873/
if you run your sinopia at localhost, default port 4873
.
-
Use browser to go to
http://${DOCKER_HOST}:${HOST_PORT}/
. You should see system running. -
Running
npm install <package>
and see if the package download successfully. Notes: cached packages do not show in web UI. Sinopia Web UI only show manually published packages.
Configure how the docker image be built.
Configures how the container interact with host. Notable variables:
CONTAINER_NAME
: container name fordocker run
HOST_PORT
: host port for container port forwarding.DATA_VOLUME
: name of data volume.
These variable can also be passed as environment variables.
How the service be run inside the container
Simply run the service:
make run
For removing existing container, then run at host port 5000:
HOST_PORT=5000 make rerun
For help:
make help
- Create a
sinopia
user, assuming its home directory is/home/sinopia
. Use following command:
sudo useradd -G docker sinopia
-
Login as
sinopia
and git clone the sourcesudo su sinopia cd git clone https://github.com/zanata/zanata-sinopia-docker-files.git exit
-
Install sinopia.service to systemd
sudo cp /home/sinopia/zanata-sinopia-docker-files/sinopia.service /etc/systemd/system/multi-user.target.wants sudo systemctl daemon-reload
-
Start the service
sudo systemctl start sinopia
docker pull zanata/sinopia2:latest
docker run -d --name ${CONTAINER_NAME} -p ${HOST_PORT}:4873 -v ${VOLUME_HOST_DIR}:/opt/sinopia/storage zanata/sinopia2:latest