Skip to content
Snippets Groups Projects
Verified Commit e3797e21 authored by Timm Fitschen's avatar Timm Fitschen
Browse files

ENH: more flexible docker container naming

parent dc745405
No related branches found
No related tags found
No related merge requests found
DOCKER_SUBNET=172.27.0.0/16 COMPOSE_PROJECT_NAME=${COMPOSE_PROJECT_NAME:-test-handle-system}
DOCKER_SUBNET_GATEWAY=172.27.0.1 DOCKER_SUBNET_PREFIX=${DOCKER_SUBNET_PREFIX:-172.27}
HANDLE_SERVER_IPV4_ADDRESS=172.27.0.2 DOCKER_SUBNET=${DOCKER_SUBNET_PREFIX}.0.0/16
DOCKER_SUBNET_GATEWAY=${DOCKER_SUBNET_PREFIX}.0.1
HANDLE_SERVER_IPV4_ADDRESS=${DOCKER_SUBNET_PREFIX}.0.2
start: .handle start: .handle
@echo "Start Handle System" @echo "Start Handle System"
docker compose up --build --detach docker compose up --build --detach
. ./.env && docker exec test-handle-net-hs_server-1 /hs/templates/wait-for-it.sh $${HANDLE_SERVER_IPV4_ADDRESS}:8000 -t 500 -- echo "HANDLE SERVICE ONLINE" . ./.env && docker exec $${COMPOSE_PROJECT_NAME}-hs-server /hs/templates/wait-for-it.sh $${HANDLE_SERVER_IPV4_ADDRESS}:8000 -t 500 -- echo "HANDLE SERVICE ONLINE"
docker exec test-handle-net-hs_server-1 bin/hdl-genericbatch /hs/setup.batch.hdl . ./.env && docker exec $${COMPOSE_PROJECT_NAME}-hs-server bin/hdl-genericbatch /hs/setup.batch.hdl
.handle: .handle:
mkdir $@ mkdir $@
stop: stop:
@echo "Stop Handle System" @echo "Stop Handle System"
docker compose down . ./.env && docker compose down
clean: stop clean: stop
@echo "Clean-up Handle System" @echo "Clean-up Handle System"
rm -rf .handle rm -rf .handle
docker compose down -v --rmi all . ./.env && docker compose down -v --rmi all
docker compose rm -vsf . ./.env && docker compose rm -vsf
...@@ -13,18 +13,18 @@ this setup is intended for **testing purposes only**. In other words: ...@@ -13,18 +13,18 @@ this setup is intended for **testing purposes only**. In other words:
## Run the HANDLE.NET server ## Run the HANDLE.NET server
``` ```
docker compose up --build make start
``` ```
## Test Web-based Handle Resolution ## Test Web-based Handle Resolution
Open `https://172.28.0.2:8000` in your browser. You should see the HANDLE.NET Open `https://172.27.0.2:8000` in your browser. You should see the HANDLE.NET
landing page where you can resolve a handle. landing page where you can resolve a handle.
## Test Web-based Admin Tool ## Test Web-based Admin Tool
Open "https://172.28.0.2:8000/admin to see the admin tool. Open "https://172.27.0.2:8000/admin to see the admin tool.
### Authenticate ### Authenticate
...@@ -32,8 +32,9 @@ Open "https://172.28.0.2:8000/admin to see the admin tool. ...@@ -32,8 +32,9 @@ Open "https://172.28.0.2:8000/admin to see the admin tool.
* Uncheck `Get ID from Global` * Uncheck `Get ID from Global`
* Insert fields: * Insert fields:
* Index: 300 * Index: 300
* Handle: 0.TEST/ADMIN * Handle: TEST/ADMIN
* Click `Select private key` and select the `handle_server/templates/admpriv.bin` file. * Click `Select private key` and select the
`handle_server/templates/admpriv.bin` file.
* Click `Authenticate` at the bottom of the form. * Click `Authenticate` at the bottom of the form.
Now you can use the `Tools` from the menu to do stuff. Now you can use the `Tools` from the menu to do stuff.
...@@ -48,9 +49,9 @@ During start-up, the docker container outputs two configuration files to the ...@@ -48,9 +49,9 @@ During start-up, the docker container outputs two configuration files to the
client and override the default behaviour which would connect the clients to client and override the default behaviour which would connect the clients to
the global handle system. the global handle system.
* The `resolver_site`. Handle clients use this file to build a local (non-default) resolver. * The `bootstrap_handles`. This contains the root connection to handle
* The `local_nas` file is used by the java client to determine which handles service(s).
are to be resolved with the locally defined resolver. * The `config.dct` contains basic configuration for the handle.net client.
### Option 1 (recommended) ### Option 1 (recommended)
...@@ -59,8 +60,9 @@ export JAVA_TOOL_OPTIONS="-Dnet.handle.configDir=${PATH_TO}/.handle" ...@@ -59,8 +60,9 @@ export JAVA_TOOL_OPTIONS="-Dnet.handle.configDir=${PATH_TO}/.handle"
``` ```
You can just configure the client by passing the java system property You can just configure the client by passing the java system property
"net.handle.configDir" pointing to the `.handle` directory by path. This can be achieved by passing "net.handle.configDir" pointing to the `.handle` directory by path. This can be
`-Dnet.handle.configDir=${PATH_TO}/.handle` to the java executable or by exporting it they way shown above. achieved by passing `-Dnet.handle.configDir=${PATH_TO}/.handle` to the java
executable or by exporting it they way shown above.
### Option 2 ### Option 2
...@@ -70,24 +72,38 @@ handle network. ...@@ -70,24 +72,38 @@ handle network.
## Change IP Address of the Server ## Change IP Address of the Server
By default, the IP address of the server is configured to be `172.28.0.2`. The By default, the IP address of the server is configured to be `172.27.0.2`. The
server is only available in from your host machine because docker is creating server is only available in from your host machine because docker is creating
the network for you that way. the network for you that way.
> Server does not start: failed to create network local-fdo-testbed-hs-network:
> Error response from daemon: invalid pool request: Pool overlaps with other
> one on this address space
Should there be a problem, e.g. the address range is also used by your LAN or Should there be a problem, e.g. the address range is also used by your LAN or
by other docker networks, you can change the `.env` file. E.g. try `172.27` by other docker networks, you can change the `.env` file. E.g. try `172.26`
instead of `172.28`. instead of `172.26` as the `DOCKER_SUBNET_PREFIX` or run
```
DOCKER_SUBNET_PREFIX=172.26 make start
Note: If you have started the server in the past you might need to remove the Note: If you have started the server in the past you might need to remove the
docker network by hand before you can start the server with the new docker network by hand before you can start the server with the new
IP address configuration: `docker network rm test-handle-net_hs_network` IP address configuration: `docker network rm test-handle-system-hs-network`
## Wipe Database ## Wipe Database
The database is preserved when your stop the server with
```
make stop
```
You can remove all persistent data by removing the container and the volume: You can remove all persistent data by removing the container and the volume:
1. `docker container rm test-handle-net_hs_server-1` ```
2. `docker volume rm test-handle-net_hs_srv1` make clean
```
## Licence ## Licence
......
name:
test-handle-net
services: services:
hs_server: hs-server:
container_name: "${COMPOSE_PROJECT_NAME}-hs-server"
build: build:
context: ./handle_server context: ./handle_server
env_file: .env env_file: .env
networks: networks:
hs_network: hs-network:
ipv4_address: ${HANDLE_SERVER_IPV4_ADDRESS} ipv4_address: ${HANDLE_SERVER_IPV4_ADDRESS}
volumes: volumes:
- hs_srv1:/hs/srv_1 - hs-srv1:/hs/srv_1
- type: bind - type: bind
source: ./.handle/ source: ./.handle/
target: /root/.handle/ target: /root/.handle/
networks: networks:
hs_network: hs-network:
name: "${COMPOSE_PROJECT_NAME}-hs-network"
driver: bridge driver: bridge
ipam: ipam:
config: config:
- subnet: ${DOCKER_SUBNET} - subnet: ${DOCKER_SUBNET}
gateway: ${DOCKER_SUBNET_GATEWAY} gateway: ${DOCKER_SUBNET_GATEWAY}
volumes: volumes:
hs_srv1: hs-srv1:
name: "${COMPOSE_PROJECT_NAME}-hs-volume"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment