Skip to content

Added changes to run it with local storage on Macbook #162

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,48 @@ Okteto is utilized for debugging. New build targets have been added to allow bui
5. (test changes, find they don't work, make more changes)...
6. `okteto down`
7. (commit code, and be happy)


## Running the Registry Locally (MacBook Example)

1. **Prepare the data directory:**

```sh
cd registry/
mkdir -p data
chmod 777 data
```

2. **Build the Docker image:**

```sh
docker build -t my-ttlsh:latest .
```

3. **Run the registry container:**

```sh
docker run -d \
-p 5000:5000 \
--name ttlsh \
-e PORT=5000 \
-e HOOK_TOKEN=localtoken \
-e HOOK_URI=http://localhost:9999/hook \
-e REPLREG_HOST=localhost:5000 \
-e REPLREG_SECRET=localsecret \
-v ttlsh-data:/var/lib/registry \
my-ttlsh:latest
```

4. **Verify the registry is running:**

- Check logs:
```sh
docker logs ttlsh
```
- Test the registry API:
```sh
curl http://localhost:5000/v2/
```

This will start the Docker registry with your local configuration and environment variables.
11 changes: 4 additions & 7 deletions registry/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,8 @@ log:
storage:
delete:
enabled: true

gcs:
bucket: replreg
keyfile: /etc/gcs.json
rootdirectory: /
filesystem:
rootdirectory: /var/lib/registry

http:
addr: 0.0.0.0:__PORT__
Expand All @@ -22,8 +19,8 @@ notifications:
- name: rgstry-hooks
url: __HOOK_URI__
headers:
Authorization: ["Token __HOOK_TOKEN__"]
Authorization:
- "Token __HOOK_TOKEN__"
timeout: 200ms
threshold: 3
backoff: 5s

21 changes: 5 additions & 16 deletions registry/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,22 +1,11 @@
#!/bin/sh

set -e

sed -i "s/__PORT__/$PORT/g" /etc/docker/registry/config.yml
sed -i "s/__HOOK_TOKEN__/$HOOK_TOKEN/g" /etc/docker/registry/config.yml
sed -i "s/__HOOK_URI__/$HOOK_URI/g" /etc/docker/registry/config.yml
sed -i "s/__REPLREG_HOST__/$REPLREG_HOST/g" /etc/docker/registry/config.yml
sed -i "s/__REPLREG_SECRET__/$REPLREG_SECRET/g" /etc/docker/registry/config.yml

if [[ -z "${GCS_KEY_ENCODED}" ]]; then
echo "Set GCS_KEY_ENCODED variable"
else
echo ${GCS_KEY_ENCODED} | base64 -d > /etc/gcs.json
chmod 0400 /etc/gcs.json
fi

# Run garbage collection job in background
# /garbage-collect.sh &
sed -i "s|__PORT__|$PORT|g" /etc/docker/registry/config.yml
sed -i "s|__HOOK_TOKEN__|$HOOK_TOKEN|g" /etc/docker/registry/config.yml
sed -i "s|__HOOK_URI__|$HOOK_URI|g" /etc/docker/registry/config.yml
sed -i "s|__REPLREG_HOST__|$REPLREG_HOST|g" /etc/docker/registry/config.yml
sed -i "s|__REPLREG_SECRET__|$REPLREG_SECRET|g" /etc/docker/registry/config.yml

case "$1" in
*.yaml|*.yml) set -- registry serve "$@" ;;
Expand Down