Skip to content

Commit

Permalink
enh: rename image for better discoverability (#8)
Browse files Browse the repository at this point in the history
* enh: rename image for better discoverability
  • Loading branch information
andrey18106 authored Feb 1, 2024
1 parent 2d9a40b commit 9bbf05b
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ jobs:
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: aa-docker-socket-proxy-buildx-${{ github.sha }}
key: nextcloud-appapi-dsp-buildx-${{ github.sha }}
restore-keys: |
aa-docker-socket-proxy-buildx-
nextcloud-appapi-dsp-buildx-
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
Expand All @@ -50,7 +50,7 @@ jobs:
context: .
platforms: linux/amd64
file: Dockerfile
tags: aa-docker-socket-proxy:${{ github.sha }}
tags: nextcloud-appapi-dsp:${{ github.sha }}
load: true
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new
Expand All @@ -75,8 +75,8 @@ jobs:
platforms: linux/amd64,linux/arm64
file: Dockerfile
tags: |
ghcr.io/cloud-py-api/aa-docker-socket-proxy:${{ github.event_name == 'release' && 'release' || 'latest' }}
ghcr.io/cloud-py-api/aa-docker-socket-proxy:${{ github.ref_name }}
ghcr.io/cloud-py-api/nextcloud-appapi-dsp:${{ github.event_name == 'release' && 'release' || 'latest' }}
ghcr.io/cloud-py-api/nextcloud-appapi-dsp:${{ github.ref_name }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new
- name: Move cache
Expand Down
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ We highly recommend to use it **in all cases**, except for **Nextcloud AIO**, in
```shell
docker run -e NC_HAPROXY_PASSWORD="some_secure_password" \
-v /var/run/docker.sock:/var/run/docker.sock \
--name aa-docker-socket-proxy -h aa-docker-socket-proxy \
--restart unless-stopped --privileged -d ghcr.io/cloud-py-api/aa-docker-socket-proxy:release
--name nextcloud-appapi-dsp -h nextcloud-appapi-dsp \
--restart unless-stopped --privileged -d ghcr.io/cloud-py-api/nextcloud-appapi-dsp:release
```

Instead of `some_secure_password` you put your password that later you should provide to AppAPI during Daemon creation.
Expand All @@ -36,8 +36,8 @@ docker run -e NC_HAPROXY_PASSWORD="some_secure_password" \
-e BIND_ADDRESS="x.y.z.z"
-v /var/run/docker.sock:/var/run/docker.sock \
-v `pwd`/certs/cert.pem:/certs/cert.pem \
--name aa-docker-socket-proxy -h aa-docker-socket-proxy --net host \
--restart unless-stopped --privileged -d ghcr.io/cloud-py-api/aa-docker-socket-proxy:release
--name nextcloud-appapi-dsp -h nextcloud-appapi-dsp --net host \
--restart unless-stopped --privileged -d ghcr.io/cloud-py-api/nextcloud-appapi-dsp:release
```

Here in addition we map certificate file from host with SSL certificate that will be used by HaProxy and specify to use the `host` network.
Expand Down Expand Up @@ -69,27 +69,27 @@ You should set `BIND_ADDRESS` to the IP on which server with ExApps can accept r
To build image locally use:

```shell
docker build -f ./Dockerfile -t aa-docker-socket-proxy:latest ./
docker build -f ./Dockerfile -t nextcloud-appapi-dsp:latest ./
```

Deploy image(for `nextcloud-docker-dev`):

```shell
docker run -e NC_HAPROXY_PASSWORD="some_secure_password" \
-v /var/run/docker.sock:/var/run/docker.sock \
--name aa-docker-socket-proxy -h aa-docker-socket-proxy --net master_default \
--privileged -d aa-docker-socket-proxy:latest
--name nextcloud-appapi-dsp -h nextcloud-appapi-dsp --net master_default \
--privileged -d nextcloud-appapi-dsp:latest
```

After that create daemon in AppAPI from the Docker Socket Proxy template, specifying:
1. Host: `aa-docker-socket-proxy:2375`
1. Host: `nextcloud-appapi-dsp:2375`
2. Network in Deploy Config equal to `master_default`
3. Deploy Config: HaProxy password: `some_secure_password`

### HTTPS(remote)

We will emulate remote deployment still with `nextcloud-docker-dev` setup.
For this we deploy `aa-docker-socket-proxy` to host network and reach it using `host.docker.internal`.
For this we deploy `nextcloud-appapi-dsp` to host network and reach it using `host.docker.internal`.

> [!NOTE]
> Due to current Docker limitations, this setup type is not working on macOS.
Expand Down Expand Up @@ -118,8 +118,8 @@ docker run -e NC_HAPROXY_PASSWORD="some_secure_password" \
-e BIND_ADDRESS="172.17.0.1" \
-v /var/run/docker.sock:/var/run/docker.sock \
-v `pwd`/certs/cert.pem:/certs/cert.pem \
--name aa-docker-socket-proxy -h aa-docker-socket-proxy --net host \
--privileged -d aa-docker-socket-proxy:latest
--name nextcloud-appapi-dsp -h nextcloud-appapi-dsp --net host \
--privileged -d nextcloud-appapi-dsp:latest
```

After that create daemon in AppAPI from the Docker Socket Proxy template, with next parameters:
Expand Down
8 changes: 4 additions & 4 deletions tests/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@


def remove_haproxy():
run("docker container rm aa-docker-socket-proxy --force".split(), stderr=DEVNULL, stdout=DEVNULL, check=False)
run("docker container rm nextcloud-appapi-dsp --force".split(), stderr=DEVNULL, stdout=DEVNULL, check=False)


def start_haproxy(port: int = 2375):
tag = environ.get("TAG_SUFFIX", "latest")
run(f"docker run -e NC_HAPROXY_PASSWORD='some_secure_password' -e HAPROXY_PORT={port} "
"-v /var/run/docker.sock:/var/run/docker.sock "
f"--name aa-docker-socket-proxy -h aa-docker-socket-proxy -p {port}:{port} "
f"--rm --privileged -d aa-docker-socket-proxy:{tag}".split(),
f"--name nextcloud-appapi-dsp -h nextcloud-appapi-dsp -p {port}:{port} "
f"--rm --privileged -d nextcloud-appapi-dsp:{tag}".split(),
stdout=DEVNULL,
check=True)


def wait_heartbeat():
for i in range(60):
r = run(
["docker", "inspect", "--format='{{json .State.Health.Status}}'", "aa-docker-socket-proxy"],
["docker", "inspect", "--format='{{json .State.Health.Status}}'", "nextcloud-appapi-dsp"],
capture_output=True, check=True, )
r = r.stdout.decode("UTF-8")
if r.find("healthy") != -1:
Expand Down

0 comments on commit 9bbf05b

Please sign in to comment.