diff --git a/.env b/.env index fe45b31ba671da025d152264e6efaebeae0755fc..5c6d7d93ab452f7f6d5c3be75dc67df4aba8642d 100644 --- a/.env +++ b/.env @@ -1,3 +1,5 @@ -DOCKER_SUBNET=172.27.0.0/16 -DOCKER_SUBNET_GATEWAY=172.27.0.1 -HANDLE_SERVER_IPV4_ADDRESS=172.27.0.2 +COMPOSE_PROJECT_NAME=${COMPOSE_PROJECT_NAME:-test-handle-system} +DOCKER_SUBNET_PREFIX=${DOCKER_SUBNET_PREFIX:-172.27} +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 diff --git a/Makefile b/Makefile index ae0d003e3c37d8026e83cb156d784f38e54ffc69..ac4ce1f510d6ecbd8fd90be94e76f8546774aab0 100644 --- a/Makefile +++ b/Makefile @@ -1,18 +1,18 @@ start: .handle @echo "Start Handle System" 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" - docker exec test-handle-net-hs_server-1 bin/hdl-genericbatch /hs/setup.batch.hdl + . ./.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" + . ./.env && docker exec $${COMPOSE_PROJECT_NAME}-hs-server bin/hdl-genericbatch /hs/setup.batch.hdl .handle: mkdir $@ stop: @echo "Stop Handle System" - docker compose down + . ./.env && docker compose down clean: stop @echo "Clean-up Handle System" rm -rf .handle - docker compose down -v --rmi all - docker compose rm -vsf + . ./.env && docker compose down -v --rmi all + . ./.env && docker compose rm -vsf diff --git a/README.md b/README.md index f1a7c26484403e866fdebc6b4280563daaee2cd5..14178cb6ada20a156a46329bbf451cc9a57b8dd7 100644 --- a/README.md +++ b/README.md @@ -13,18 +13,18 @@ this setup is intended for **testing purposes only**. In other words: ## Run the HANDLE.NET server ``` -docker compose up --build +make start ``` ## 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. ## 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 @@ -32,8 +32,9 @@ Open "https://172.28.0.2:8000/admin to see the admin tool. * Uncheck `Get ID from Global` * Insert fields: * Index: 300 - * Handle: 0.TEST/ADMIN -* Click `Select private key` and select the `handle_server/templates/admpriv.bin` file. + * Handle: TEST/ADMIN +* Click `Select private key` and select the + `handle_server/templates/admpriv.bin` file. * Click `Authenticate` at the bottom of the form. 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 client and override the default behaviour which would connect the clients to the global handle system. -* The `resolver_site`. Handle clients use this file to build a local (non-default) resolver. -* The `local_nas` file is used by the java client to determine which handles - are to be resolved with the locally defined resolver. +* The `bootstrap_handles`. This contains the root connection to handle + service(s). +* The `config.dct` contains basic configuration for the handle.net client. ### Option 1 (recommended) @@ -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 -"net.handle.configDir" pointing to the `.handle` directory by path. This can be achieved by passing -`-Dnet.handle.configDir=${PATH_TO}/.handle` to the java executable or by exporting it they way shown above. +"net.handle.configDir" pointing to the `.handle` directory by path. This can be +achieved by passing `-Dnet.handle.configDir=${PATH_TO}/.handle` to the java +executable or by exporting it they way shown above. ### Option 2 @@ -70,24 +72,38 @@ handle network. ## 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 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 -by other docker networks, you can change the `.env` file. E.g. try `172.27` -instead of `172.28`. +by other docker networks, you can change the `.env` file. E.g. try `172.26` +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 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 +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: -1. `docker container rm test-handle-net_hs_server-1` -2. `docker volume rm test-handle-net_hs_srv1` +``` +make clean +``` ## Licence diff --git a/docker-compose.yml b/docker-compose.yml index 148d9922c4f2b1ef64a00f2e2ebb8f6a94b35e3a..195fb82a960d22ed93f8af758f5a7e466f753c74 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,25 +1,26 @@ -name: - test-handle-net services: - hs_server: + hs-server: + container_name: "${COMPOSE_PROJECT_NAME}-hs-server" build: context: ./handle_server env_file: .env networks: - hs_network: + hs-network: ipv4_address: ${HANDLE_SERVER_IPV4_ADDRESS} volumes: - - hs_srv1:/hs/srv_1 + - hs-srv1:/hs/srv_1 - type: bind source: ./.handle/ target: /root/.handle/ networks: - hs_network: + hs-network: + name: "${COMPOSE_PROJECT_NAME}-hs-network" driver: bridge ipam: config: - subnet: ${DOCKER_SUBNET} gateway: ${DOCKER_SUBNET_GATEWAY} volumes: - hs_srv1: + hs-srv1: + name: "${COMPOSE_PROJECT_NAME}-hs-volume"