-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: Add compose-based dev&test environment
Add a compose-based environment to build, run, and test the composectl utility. The environment includes the foundries specific docker registry and daemon (vanilla version + required patches). Signed-off-by: Mike Sul <[email protected]>
- Loading branch information
Showing
10 changed files
with
200 additions
and
0 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
.idea | ||
bin/ | ||
.cache |
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,9 @@ | ||
down() { | ||
docker compose --env-file=test/compose/.env.test -f test/compose/docker-compose.yml down --remove-orphans | ||
# remove the docker runtime and compose app store volumes | ||
docker volume rm compose_docker-runtime compose_reset-apps | ||
} | ||
|
||
trap down EXIT | ||
|
||
docker compose --env-file=test/compose/.env.test -f test/compose/docker-compose.yml run composectl $@ |
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,10 @@ | ||
SRC_DIR=$PWD | ||
BIN_DIR=$SRC_DIR/bin | ||
TEST_DIR=$SRC_DIR/test | ||
CPS_DIR=$TEST_DIR/compose | ||
INIT_SCRIPT=$CPS_DIR/init.sh | ||
|
||
REG_DIR=$CPS_DIR/registry | ||
REG_CERT_DIR=$REG_DIR/certs | ||
# This must be relative to SRC_DIR path | ||
REG_CERT=test/compose/registry/certs/registry.crt |
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,13 @@ | ||
FROM golang:1.22-alpine | ||
|
||
ARG REG_CERT=test/compose/registry/certs/registry.crt | ||
ARG SRC_DIR=$PWD | ||
|
||
RUN apk add make curl docker docker-compose git | ||
|
||
COPY $REG_CERT /etc/ssl/certs/registry.crt | ||
RUN cat /etc/ssl/certs/registry.crt >> /etc/ssl/certs/ca-certificates.crt | ||
WORKDIR /build | ||
COPY go.mod go.sum ./ | ||
RUN go mod download | ||
RUN git config --global --add safe.directory $SRC_DIR |
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,42 @@ | ||
services: | ||
registry: | ||
image: ghcr.io/foundriesio/docker-distribution:2.8.3-fio | ||
volumes: | ||
- ${REG_CERT_DIR}:/certs | ||
- ${REG_DIR}/config.yml:/etc/docker/registry/config.yml | ||
|
||
dockerd: | ||
image: ghcr.io/foundriesio/moby:25.0.3_fio | ||
command: ["dockerd", "-D", "-H", "unix:///var/run/docker/docker.sock"] | ||
privileged: true | ||
volumes: | ||
- docker-runtime:/var/run/docker | ||
- ${REG_DIR}/daemon.json:/etc/docker/daemon.json:ro | ||
- reset-apps:/var/sota/reset-apps | ||
|
||
composectl: | ||
build: | ||
context: ${SRC_DIR} | ||
dockerfile: ${CPS_DIR}/Dockerfile | ||
args: | ||
REG_CERT: ${REG_CERT} | ||
SRC_DIR: ${SRC_DIR} | ||
volumes: | ||
- ${SRC_DIR}:${SRC_DIR} | ||
- ${BIN_DIR}:${SRC_DIR}/bin | ||
- docker-runtime:/var/run/docker | ||
- reset-apps:/var/sota/reset-apps | ||
working_dir: ${SRC_DIR} | ||
depends_on: | ||
- registry | ||
- dockerd | ||
environment: | ||
- GOCACHE=${SRC_DIR}/.cache | ||
- DOCKER_HOST=unix:///var/run/docker/docker.sock | ||
- COMPOSECTL_EXE=${BIN_DIR}/composectl | ||
- SRC_DIR=${SRC_DIR} | ||
- STOREROOT=/var/sota/reset-apps | ||
|
||
volumes: | ||
docker-runtime: | ||
reset-apps: |
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,25 @@ | ||
[ req ] | ||
default_bits = 4096 | ||
distinguished_name = req_distinguished_name | ||
req_extensions = req_ext | ||
x509_extensions = v3_req | ||
prompt = no | ||
|
||
[ req_distinguished_name ] | ||
C = US | ||
ST = State | ||
L = City | ||
O = Organization | ||
CN = registry | ||
|
||
[ req_ext ] | ||
subjectAltName = @alt_names | ||
|
||
[ v3_req ] | ||
subjectAltName = @alt_names | ||
|
||
[ alt_names ] | ||
DNS.1 = registry | ||
DNS.2 = localhost | ||
IP.1 = 127.0.0.1 | ||
|
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,31 @@ | ||
-----BEGIN CERTIFICATE----- | ||
MIIFYjCCA0qgAwIBAgIUM75BXTHDQOio38zfJu9yYDSYY1EwDQYJKoZIhvcNAQEL | ||
BQAwVjELMAkGA1UEBhMCVVMxDjAMBgNVBAgMBVN0YXRlMQ0wCwYDVQQHDARDaXR5 | ||
MRUwEwYDVQQKDAxPcmdhbml6YXRpb24xETAPBgNVBAMMCHJlZ2lzdHJ5MB4XDTI0 | ||
MDkwOTEyMjU0NFoXDTI1MDkwOTEyMjU0NFowVjELMAkGA1UEBhMCVVMxDjAMBgNV | ||
BAgMBVN0YXRlMQ0wCwYDVQQHDARDaXR5MRUwEwYDVQQKDAxPcmdhbml6YXRpb24x | ||
ETAPBgNVBAMMCHJlZ2lzdHJ5MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICC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t9Tv7Ji69GfGea4TTLuzkCkJ6saHRIU1i9ZHKlu | ||
Bk8lLnnUrPURAjGTQHTAe0vmM7fOuI3f6iBHqoT3/uH2Eq0LbR70Akn1Y75a8GaC | ||
HeXih6Fh19FGD+VzGZod9leY7tEtmKduqyO4xSi3aMHDyjxRyVEE8U1e5KryfeKz | ||
gFuyJdQfnxalENL4vh78V7K+uHXifKaGMvlwBWDHFM3fvLFCsIaiOY4xWir1vNMb | ||
VrfV0k3wHt66Hhs2iDWzwix84aiOEM+k0PytLBNUchRG4dutS6JHgb/8cFjU+Td9 | ||
OS9Rd2vpF4Dk06YcFCw9J0IAjjruejsE1AzmQMDfEdO1J38UDYURiazNMhd01AIE | ||
+m6QbC6xgtHmBVFUSfnWL8VGDzOr4Zkyb+ZRzb4AZYSJlO/fAiP9UO+hcEDEjoC2 | ||
ugjs6ZackH00Hs8Ps6xzYaJQNYS2bM4fYF0jbaf5YiO8U/Nnp8o= | ||
-----END CERTIFICATE----- |
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,52 @@ | ||
-----BEGIN PRIVATE KEY----- | ||
MIIJQQIBADANBgkqhkiG9w0BAQEFAASCCSswggknAgEAAoICAQDDgr9UfAYlEhs5 | ||
a6rtLvfvsMPjNRttI2pXuzcux/UjfdX3nZJGXhwEioQdsWPyRXNXQD3R1dNsaXKp | ||
tTxwR/7sI3ChLKKAJHdK+SpASscXazMIxPvAbnh2Hou38dpSks0Sfp27DkqDj3aC | ||
xIE2dNnjrgYHpFQCK5uYSecRze7NNEdClpHj5wOfy0/X/zW+94IjxprH/C9tnIGU | ||
n5tenqa+BVfGS1AFvg9ZwoXHU1y6wehYdV/uZsRci2K/mIPo27Lkjp4sp52UJC0a | ||
TISO+5bkmzhDgaDX6taFJkhcWX2R+XcjHEbg/WkWS8iR5Um6eN/hk6wYx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LDDT40kD4AAPqMAtwLK9XjlgN0dJitPHiUEZbFMZPs | ||
atyckmdatFLQD+69KA0jW/Hjsqe3FiCbwaApCiECggEAZofoLR0bZVkEF10Ai7Br | ||
ifXa+aSaRzGyoqub/YxjpTmddY0phaBSg05hDSKJjdPAEqdA9zZ7mrLjwMMzE4Ex | ||
HvspcD+jbUqYEY19WkmfLCLcDkyW1v186c5jqpxYnJ+iyk97Bu4EwuDYWmWLV1Z+ | ||
sm/9Om4oACCslxPqYm9H5DAjrQa7D2es38Jsu8WSxIwCIqTwoRd7PV95HLYX41JG | ||
q0qWqa5Bqr9nwQAIAMwx26QJ2D8D3tYbxxteR0t6fkv9ZRHDE7s6F8oYO7DmsvE9 | ||
3suvoBScBI3DMxCIQz6OGAeP/Micd4/XEoZL/3nWcRbHXQNZb+//n9BPIjT4k3qA | ||
iQKCAQAvM9FK+wrwMg2gaVObUX6vsA1WH7oHLLLyJFZACKUIGvshozEKBBY84Rn3 | ||
LqlN3mF+7oNND8UZlpnFDhKP/+r7B9nCZ9Gap64yN32kAXTqBbxrJeygIIj0dgvF | ||
kYTe4JdF36nlR78rr5xydCUDeORAgUyGi3zXs991MKAJfrNi64IkpTJGWF86k401 | ||
rpvImtzxIg7C+G5ooIt4TdAzF2VJw9bjrVY4B/PwM05yYi1c/Hmh7ffvnkFkxlAT | ||
iPWV4Tt+bPdR8eRs8HhDmxo7XOjTfIcFlZZ3eSq8oBLTRy0F08OPpvmQ4hlMJg0H | ||
U7cB1TFXInU+FMJXq4Gh9cYnKBgh | ||
-----END PRIVATE KEY----- |
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,14 @@ | ||
version: 0.1 | ||
log: | ||
level: debug | ||
fields: | ||
service: registry | ||
environment: development | ||
storage: | ||
filesystem: | ||
rootdirectory: /var/lib/registry | ||
http: | ||
addr: :5000 | ||
tls: | ||
certificate: /certs/registry.crt | ||
key: /certs/registry.key |
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,3 @@ | ||
{ | ||
"insecure-registries": ["registry:5000"] | ||
} |