-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
005 ipfs docker registry #19
Closed
Closed
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
e6078c9
[005] Added Dockerfile to build Docker Registry for bind-mounting aga…
hosh c66edc5
[005] Set up demo Makefile
hosh 525dfac
[005] Build ipfs-docker-registry from source
hosh 12affc0
[005] Add docker pull demo
hosh 3f5b92b
[005] Added README
hosh 1cf7b79
[DOC] Simplified daemon mount instructions
hosh 19aa8e5
[005] Removed sudo from docker commands
hosh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
container_name=ipfs-registry | ||
container_tag=ipfs/docker-registry:0.1.0 | ||
|
||
demo_image_id=bf25c3f7f322 | ||
demo_image_path=/ipfs/QmfG9AUHSc2oeFJ1kVNqoh4UA61knu4WnetawW53kApiGM/wiki-node.img | ||
demo_container_tag=ipfs-demo/wiki-node:latest | ||
|
||
define notfound | ||
$(image_path) not found | ||
Make sure the daemon is running and mounted with allow_other: | ||
ipfs config Mounts.AllowOther --bool true | ||
ipfs daemon --mount & | ||
sleep 10 | ||
|
||
If you are having trouble mounting IPFS, please see https://github.com/jbenet/go-ipfs/blob/master/docs/fuse.md | ||
endef | ||
export notfound | ||
|
||
demo: ipfs-docker load-demo | ||
docker tag -f $(demo_container_tag) localhost:5000/wiki-node | ||
docker push localhost:5000/wiki-node | ||
@echo | ||
@echo Look, we have a registry | ||
@echo | ||
ls /ipns/local/docker-registry/images | ||
@echo | ||
@echo Deleting demo image and try a pull | ||
@echo | ||
docker rmi -f $(demo_image_id) | ||
docker pull localhost:5000/wiki-node | ||
|
||
ipfs-docker: /ipns/local/docker-registry | ||
@echo Starting docker-registry on ipfs if it is not already started | ||
@stat /ipns/local >/dev/null 2>/dev/null || (echo "$$notfound" && false) | ||
docker ps | grep ipfs-registry || docker run -d \ | ||
-p 5000:5000 \ | ||
--name $(container_name) \ | ||
-v /ipns/local/docker-registry:/ipns/local/docker-registry \ | ||
-t \ | ||
$(container_tag) | ||
|
||
/ipns/local/docker-registry: | ||
mkdir /ipns/local/docker-registry | ||
|
||
load-demo: | ||
@echo Loading demo image if it is not already loaded | ||
@stat $(demo_image_path) >/dev/null 2>/dev/null || (echo "$$notfound" && false) | ||
docker images | grep $(demo_image_id) || docker load < $(demo_image_path) | ||
docker tag -f $(demo_image_id) $(demo_container_tag) | ||
|
||
stop: | ||
docker stop $(container_name) | ||
docker rm $(container_name) | ||
|
||
rel-clean: | ||
rm -fr /ipns/local/docker-registry | ||
|
||
clean: stop rel-clean | ||
docker rmi -f $(demo_image_id) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# Running docker-registry on IPFS | ||
|
||
## Quick Start | ||
|
||
We have already prepared a docker-registry configured for IPFS and a demo container for you. | ||
|
||
To run this demo: | ||
|
||
1. Make sure `ipfs` daemon is running and mounted with `allow_other` | ||
```sh | ||
export PATH=${HOME}/ipfs/bin:${PATH} | ||
ipfs config Mounts.FuseAllowOther --bool true | ||
ipfs daemon --mount & | ||
sleep 10 | ||
``` | ||
If you are having trouble with FUSE, please see: https://github.com/jbenet/go-ipfs/blob/master/docs/fuse.md | ||
|
||
2. Make sure you can run Docker without `sudo`. For Ubuntu Linux users, see: https://askubuntu.com/questions/477551/how-can-i-use-docker-without-sudo/477554#477554 | ||
|
||
3. Build the ipfs docker registry | ||
```sh | ||
cd src | ||
make | ||
cd .. | ||
``` | ||
|
||
4. Run ```make``` | ||
|
||
## Start Docker Registry on another machine | ||
|
||
Try bringing up the ipfs-docker-registry on another box, pointing to the ID of the original | ||
|
||
First, get the $ID on the first machine: | ||
```sh | ||
ipfs id | ||
``` | ||
|
||
On a different machine: | ||
|
||
```sh | ||
export PATH=${HOME}/ipfs/bin:${PATH} | ||
ipfs config Mounts.FuseAllowOther --bool true | ||
ipfs daemon --mount | ||
|
||
cd src; make; cd .. | ||
|
||
sudo docker ps | grep ipfs-registry || sudo docker run -d \ | ||
-p 5000:5000 \ | ||
--name ipfs-registry \ | ||
-v /ipns/$ID/docker-registry:/ipns/local/docker-registry \ | ||
-t \ | ||
ipfs/docker-registry:0.1.0 | ||
|
||
sudo docker pull localhost:5000/wiki-node | ||
``` | ||
|
||
## Discussion | ||
|
||
IPFS currenly only supports a single FUSE option, `allow_other`. By mounting IPFS with `allow_other`, you | ||
can run Docker containers on top of IPFS. | ||
|
||
This demo also demonstrates the difference between client-server architecture and a distributed application. | ||
Rather than specifying a remote registry with a URL, a local docker registry is mounted against a remote | ||
IPFS location. The images contained in that registry are transferred with the IPFS swarming protocol. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
FROM registry | ||
|
||
# Add the custom configuration file we made | ||
ADD ./config.yml /docker-registry/config/config.yml | ||
|
||
# Create the data directory | ||
# This is intended to be bind-mounted to IPFS via FUSE on the | ||
# host machine | ||
RUN mkdir -p /ipns/local/docker-registry/ | ||
|
||
# Set the configuration file to config.yml | ||
env DOCKER_REGISTRY_CONFIG /docker-registry/config/config.yml | ||
|
||
# Make sure we use the prod configuration settings | ||
env SETTINGS_FLAVOR prod |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
container_tag=ipfs/docker-registry:0.1.0 | ||
|
||
build: | ||
docker build -t $(container_tag) . | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,159 @@ | ||
# All other flavors inherit the `common' config snippet | ||
common: &common | ||
# Default log level is info | ||
loglevel: _env:LOGLEVEL:info | ||
# By default, the registry acts standalone (eg: doesn't query the index) | ||
standalone: _env:STANDALONE:true | ||
# The default endpoint to use (if NOT standalone) is index.docker.io | ||
index_endpoint: _env:INDEX_ENDPOINT:https://index.docker.io | ||
# Storage redirect is disabled | ||
storage_redirect: _env:STORAGE_REDIRECT | ||
# Token auth is enabled (if NOT standalone) | ||
disable_token_auth: _env:DISABLE_TOKEN_AUTH | ||
# No priv key | ||
privileged_key: _env:PRIVILEGED_KEY | ||
# No search backend | ||
search_backend: _env:SEARCH_BACKEND | ||
# SQLite search backend | ||
sqlalchemy_index_database: _env:SQLALCHEMY_INDEX_DATABASE:sqlite:////tmp/docker-registry.db | ||
|
||
# Mirroring is not enabled | ||
mirroring: | ||
source: _env:MIRROR_SOURCE # https://registry-1.docker.io | ||
source_index: _env:MIRROR_SOURCE_INDEX # https://index.docker.io | ||
tags_cache_ttl: _env:MIRROR_TAGS_CACHE_TTL:172800 # seconds | ||
|
||
cache: | ||
host: _env:CACHE_REDIS_HOST | ||
port: _env:CACHE_REDIS_PORT | ||
db: _env:CACHE_REDIS_DB:0 | ||
password: _env:CACHE_REDIS_PASSWORD | ||
|
||
# Enabling LRU cache for small files | ||
# This speeds up read/write on small files | ||
# when using a remote storage backend (like S3). | ||
cache_lru: | ||
host: _env:CACHE_LRU_REDIS_HOST | ||
port: _env:CACHE_LRU_REDIS_PORT | ||
db: _env:CACHE_LRU_REDIS_DB:0 | ||
password: _env:CACHE_LRU_REDIS_PASSWORD | ||
|
||
# Enabling these options makes the Registry send an email on each code Exception | ||
email_exceptions: | ||
smtp_host: _env:SMTP_HOST | ||
smtp_port: _env:SMTP_PORT:25 | ||
smtp_login: _env:SMTP_LOGIN | ||
smtp_password: _env:SMTP_PASSWORD | ||
smtp_secure: _env:SMTP_SECURE:false | ||
from_addr: _env:SMTP_FROM_ADDR:[email protected] | ||
to_addr: _env:SMTP_TO_ADDR:[email protected] | ||
|
||
# Enable bugsnag (set the API key) | ||
bugsnag: _env:BUGSNAG | ||
|
||
local: &local | ||
<<: *common | ||
storage: local | ||
storage_path: _env:STORAGE_PATH:/tmp/registry | ||
|
||
|
||
s3: &s3 | ||
<<: *common | ||
storage: s3 | ||
s3_region: _env:AWS_REGION | ||
s3_bucket: _env:AWS_BUCKET | ||
boto_bucket: _env:AWS_BUCKET | ||
storage_path: _env:STORAGE_PATH:/registry | ||
s3_encrypt: _env:AWS_ENCRYPT:true | ||
s3_secure: _env:AWS_SECURE:true | ||
s3_access_key: _env:AWS_KEY | ||
s3_secret_key: _env:AWS_SECRET | ||
|
||
# Google Cloud Storage Configuration | ||
# See: | ||
# https://developers.google.com/storage/docs/reference/v1/getting-startedv1#keys | ||
# for details on access and secret keys. | ||
gcs: | ||
<<: *common | ||
storage: gcs | ||
boto_bucket: _env:GCS_BUCKET | ||
storage_path: _env:STORAGE_PATH:/registry | ||
gs_secure: _env:GCS_SECURE:true | ||
gs_access_key: _env:GCS_KEY | ||
gs_secret_key: _env:GCS_SECRET | ||
# OAuth 2.0 authentication with the storage. | ||
# oauth2 can be set to true or false. If it is set to true, gs_access_key, | ||
# gs_secret_key and gs_secure are not needed. | ||
# Client ID and Client Secret must be set into OAUTH2_CLIENT_ID and | ||
# OAUTH2_CLIENT_SECRET environment variables. | ||
# See: https://developers.google.com/accounts/docs/OAuth2. | ||
oauth2: _env:GCS_OAUTH2:false | ||
|
||
# This flavor is for storing images in Openstack Swift | ||
swift: &swift | ||
<<: *common | ||
storage: swift | ||
storage_path: _env:STORAGE_PATH:/registry | ||
# keystone authorization | ||
swift_authurl: _env:OS_AUTH_URL | ||
swift_container: _env:OS_CONTAINER | ||
swift_user: _env:OS_USERNAME | ||
swift_password: _env:OS_PASSWORD | ||
swift_tenant_name: _env:OS_TENANT_NAME | ||
swift_region_name: _env:OS_REGION_NAME | ||
|
||
# This flavor stores the images in Glance (to integrate with openstack) | ||
# See also: https://github.com/dotcloud/openstack-docker | ||
glance: &glance | ||
<<: *common | ||
storage: glance | ||
storage_alternate: _env:GLANCE_STORAGE_ALTERNATE:file | ||
storage_path: _env:STORAGE_PATH:/tmp/registry | ||
|
||
openstack: | ||
<<: *glance | ||
|
||
# This flavor stores the images in Glance (to integrate with openstack) | ||
# and tags in Swift. | ||
glance-swift: &glance-swift | ||
<<: *swift | ||
storage: glance | ||
storage_alternate: swift | ||
|
||
openstack-swift: | ||
<<: *glance-swift | ||
|
||
elliptics: | ||
<<: *common | ||
storage: elliptics | ||
elliptics_nodes: _env:ELLIPTICS_NODES | ||
elliptics_wait_timeout: _env:ELLIPTICS_WAIT_TIMEOUT:60 | ||
elliptics_check_timeout: _env:ELLIPTICS_CHECK_TIMEOUT:60 | ||
elliptics_io_thread_num: _env:ELLIPTICS_IO_THREAD_NUM:2 | ||
elliptics_net_thread_num: _env:ELLIPTICS_NET_THREAD_NUM:2 | ||
elliptics_nonblocking_io_thread_num: _env:ELLIPTICS_NONBLOCKING_IO_THREAD_NUM:2 | ||
elliptics_groups: _env:ELLIPTICS_GROUPS | ||
elliptics_verbosity: _env:ELLIPTICS_VERBOSITY:4 | ||
elliptics_logfile: _env:ELLIPTICS_LOGFILE:/dev/stderr | ||
elliptics_addr_family: _env:ELLIPTICS_ADDR_FAMILY:2 | ||
|
||
|
||
|
||
# This is the default configuration when no flavor is specified | ||
dev: &dev | ||
<<: *local | ||
loglevel: _env:LOGLEVEL:debug | ||
search_backend: _env:SEARCH_BACKEND:sqlalchemy | ||
|
||
# This flavor is used by unit tests | ||
test: | ||
<<: *dev | ||
index_endpoint: https://indexstaging-docker.dotcloud.com | ||
standalone: true | ||
storage_path: _env:STORAGE_PATH:./tmp/test | ||
|
||
# To specify another flavor, set the environment variable SETTINGS_FLAVOR | ||
# $ export SETTINGS_FLAVOR=prod | ||
prod: | ||
<<: *local | ||
storage_path: _env:STORAGE_PATH:/ipns/local/docker-registry |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be changed to