Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
8 changes: 5 additions & 3 deletions cpp/IceBox/hello/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,21 @@ To run this demo, open two terminal windows. In the first window:
**Linux:**

```shell
LD_LIBRARY_PATH=./build icebox --IceBox.Service.Hello="HelloService:create --Ice.Trace.Dispatch"
export LD_LIBRARY_PATH=$PWD/build
icebox --IceBox.Service.Hello="HelloService:create --Ice.Trace.Dispatch"
```

**macOS:**

```shell
DYLD_LIBRARY_PATH=./build icebox --IceBox.Service.Hello="HelloService:create --Ice.Trace.Dispatch"
export DYLD_LIBRARY_PATH=$PWD/build
icebox --IceBox.Service.Hello="HelloService:create --Ice.Trace.Dispatch"
```

**Windows:**

```shell
set PATH=%PATH%;./build/Release
set PATH=%CD%\\build\\Release;%PATH%
icebox --IceBox.Service.Hello="HelloService:create --Ice.Trace.Dispatch"
```

Expand Down
4 changes: 2 additions & 2 deletions cpp/IceGrid/allocate/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ cmake -B build
cmake --build build --config Release
```

To run the demo, first open a new terminal window for the IceGrid service:
To run the demo, first open a new terminal window for the IceGrid service.

Add the server build directory to the PATH environment variable:

**Linux/macOS:**

```shell
export PATH=$(pwd)/build:$PATH
export PATH=$PWD/build:$PATH
```

**Windows:**
Expand Down
16 changes: 16 additions & 0 deletions cpp/IceGrid/customLocator/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
cmake_minimum_required(VERSION 3.16)

project(icegrid_custom_locator CXX)

include(../../cmake/common.cmake)

add_executable(client Client.cpp Hello.ice)
slice2cpp_generate(client)
target_link_libraries(client Ice::Ice)

add_executable(server Server.cpp HelloI.cpp HelloI.h Hello.ice)
slice2cpp_generate(server)
target_link_libraries(server Ice::Ice)

add_executable(locator Locator.cpp)
target_link_libraries(locator Ice::Ice)
61 changes: 55 additions & 6 deletions cpp/IceGrid/customLocator/README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,55 @@
# IceGrid Custom Locator

This demo shows how to implement a [custom locator][1] that delegates
to the [IceGrid][2] registry.

To run the demo, first start the IceGrid service:
To build the demo run:

```shell
cmake -B build
cmake --build build --config Release
```

To run the demo, first open a new terminal window for the IceGrid service:

Add the server build directory to the PATH environment variable:

**Linux/macOS:**

```shell
export PATH=$PWD/build:$PATH
```

**Windows:**

```shell
set PATH=%CD%\\build\\Release;%PATH%
```

Now start the IceGrid service:

```shell
icegridnode --Ice.Config=config.grid
```

In a separate window start the custom locator:

**Linux/macOS:**

```shell
./build/locator
```
locator

**Windows:**

```shell
build\Release\locator
```

Now in another window deploy the application:

```
icegridadmin --Ice.Config=config.grid -e "application add application.xml"
```shell
icegridadmin --Ice.Config=config.admin -e "application add application.xml"
```

The custom locator included in this demo only allows clients that set a
Expand All @@ -25,14 +58,30 @@ object.

To run the client without setting this value:

**Linux/macOS:**

```shell
./build/client
```
client

**Windows:**

```shell
build\Release\client
```

To run the client with the context set properly:

**Linux/macOS:**

```shell
./build/client --context
```
client --context

**Windows:**

```shell
build\Release\client --context
```

[1]: https://doc.zeroc.com/ice/3.7/client-server-features/locators
Expand Down
2 changes: 1 addition & 1 deletion cpp/IceGrid/customLocator/application.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<node name="node1">

<server id="SimpleServer" exe="./server" activation="on-demand">
<server id="SimpleServer" exe="server" activation="on-demand">
<adapter name="Hello" endpoints="tcp -h localhost">
<object identity="hello" type="::Demo::Hello" property="Identity"/>
</adapter>
Expand Down
5 changes: 5 additions & 0 deletions cpp/IceGrid/customLocator/config.admin
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#
# Dummy username and password for icegridadmin.
#
IceGridAdmin.Username=foo
IceGridAdmin.Password=bar
6 changes: 0 additions & 6 deletions cpp/IceGrid/customLocator/config.grid
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,3 @@ IceMX.Metrics.ByParent.Disabled=1
IceGrid.Node.Trace.Activator=1
#IceGrid.Node.Trace.Adapter=2
#IceGrid.Node.Trace.Server=3

#
# Dummy username and password for icegridadmin.
#
IceGridAdmin.Username=foo
IceGridAdmin.Password=bar
13 changes: 13 additions & 0 deletions cpp/IceGrid/icebox/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
cmake_minimum_required(VERSION 3.16)

project(icegrid_icebox CXX)

include(../../cmake/common.cmake)

add_executable(client Client.cpp Hello.ice)
slice2cpp_generate(client)
target_link_libraries(client Ice::Ice Ice::IceGrid Ice::Glacier2)

add_library(HelloService SHARED HelloServiceI.cpp HelloServiceI.h HelloI.cpp HelloI.h Hello.ice)
slice2cpp_generate(HelloService)
target_link_libraries(HelloService Ice::Ice Ice::IceBox)
5 changes: 3 additions & 2 deletions cpp/IceGrid/icebox/HelloServiceI.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// Copyright (c) ZeroC, Inc.

#include <HelloI.h>
#include <HelloServiceI.h>
#include "HelloI.h"
#include "HelloServiceI.h"

#include <Ice/Ice.h>

using namespace std;
Expand Down
128 changes: 51 additions & 77 deletions cpp/IceGrid/icebox/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# IceGrid IceBox

This demo shows a very simple [IceGrid deployment][1], with a single
[IceBox][2] server hosting a number of IceBox services.

Expand All @@ -9,112 +11,84 @@ named `LANG` with value `en`. The Hello object implementation HelloI
reads the value of `LANG` and shows the message in the corresponding
language; you can try to update the value to `fr`, `de`, `es` or `it`.

Setup
-----
To build the demo run:

Start the IceGrid registry and node:
```
icegridnode --Ice.Config=config.grid
```shell
cmake -B build
cmake --build build --config Release
```

Deploy the `HelloSimpsons` application (in file `application.xml`) with
the IceGridGUI (see below). If you prefer to use the command-line utility, use:
```
icegridadmin --Ice.Config=config.grid -e "application add application.xml"
```
## Setup

If you are using 32-bit binaries on a Linux 64-bit host, first edit
`application.xml` and replace `exe="icebox"` by `exe="icebox32"`.
To run the demo, first open a new terminal window for the IceGrid service:

Using the IceGrid GUI
---------------------
Add the server build directory to the PATH environment variable:

We suggest using the [IceGrid GUI][3] tool with this demo. Follow these steps
to log into the IceGrid registry and view the application you deployed above:
**Linux:**

- Launch the application. Windows users can use the IceGrid GUI
icon from the Start menu, macOS users can use the IceGrid GUI
icon from the Finder Applications folder, and users with a Linux
installation can use the `icegridgui` script to start the
program:
```
icegridgui
```
```shell
export PATH=$PWD/build:$PATH
export LD_LIBRARY_PATH=$PWD/build
```

- Select `Login...` from the `File menu`.
**macOS:**

- In the `Saved Connections` dialog, click `New Connection` to open
the `New Connection` wizard.
```shell
export PATH=$PWD/build:$PATH
export DYLD_LIBRARY_PATH=$PWD/build
```

- Select `Direct Connection` and click `Next`.
**Windows:**

- Let the default value `Connect to Master Registry` checked
and click `Next`.
```shell
set PATH=%CD%\\build\\Release;%PATH%
```

- On the `Discovered Registries` list select `DemoIceGrid/locator...` and
click `Next`.
Now start the IceGrid service:

- In next Window let the pre fill `IceGrid Registry Endpoint(s)` and click
`Next`.
```shell
icegridnode --Ice.Config=config.grid
```

- Enter any username and password combination and click `Finish`
to log in.
Deploy the `HelloSimpsons` application (in file `application.xml`) with
the IceGridGUI (see below). If you prefer to use the command-line utility, use:

- Next time you want to connect, the connection will appear in the
`Saved Connections` dialog, just select it and click `Connect`.
```shell
icegridadmin --Ice.Config=config.admin -e "application add application.xml"
```

Running the Client
------------------
If you are using 32-bit binaries on a Linux 64-bit host, first edit
`application.xml` and replace `exe="icebox"` by `exe="icebox32"`.

## Running the Client

To run the client type:

In a command window, start the client as shown below:
**Linux/macOS:**

```shell
./build/client
```
client

**Windows:**

```shell
build\Release\client
```

The client simply calls `sayHello` on the replicated `hello` object.

Stopping and restarting IceBox services
---------------------------------------
## Stopping and restarting IceBox services

You can use the IceGrid GUI or the command-line utility to stop and
You can use the IceGrid GUI or the `icegridadmin` command-line utility to stop and
restart IceBox services. The commands below show how to manipulate
the 'Lisa' service:
```

```shell
icegridadmin --Ice.Config=config.grid
>>> service stop IceBox Lisa
>>> service start IceBox Lisa
```

Administration through Glacier2
-------------------------------

This demo also includes the configuration for a [Glacier2 router][4]
to show how you could administer IceGrid from "the other side" of a firewall.
(In this demo, however, all the components run on the same system.)

Follow these steps:

- Connect to the IceGrid registry with icegridadmin or the IceGrid GUI

- Start the DemoGlacier2 server

- Reconnect to the IceGrid registry, this time using a Glacier2
session. For example, using the command-line utility you must
supply a proxy for the router:

```
icegridadmin --Ice.Default.Router="DemoGlacier2/router:tcp -h localhost -p 4063"
```

In the IceGrid GUI, use the `Routed` tab of the `Login` dialog.
Change the Glacier2 instance name to `DemoGlacier2` and the endpoints
to `tcp -h localhost -p 4063`.

DemoGlacier2 is configured to use a built-in permissions verifier
that does not validate passwords, so you can log in using any
username/password combination.

[1]: https://doc.zeroc.com/ice/3.7/ice-services/icegrid/using-icegrid-deployment
[2]: https://doc.zeroc.com/ice/3.7/icebox
[3]: https://doc.zeroc.com/ice/3.7/ice-services/icegrid/icegrid-gui-tool
[4]: https://doc.zeroc.com/ice/3.7/ice-services/glacier2/icegrid-and-glacier2-integration
2 changes: 1 addition & 1 deletion cpp/IceGrid/icebox/application.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<service-template id="HelloService">
<parameter name="name"/>
<service name="${name}" entry="./HelloService:create">
<service name="${name}" entry="HelloService:create">
<description>A very simple service named after ${name}</description>
<properties>
<properties refid="mx"/>
Expand Down
6 changes: 6 additions & 0 deletions cpp/IceGrid/icebox/config.admin
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

#
# Dummy username and password for icegridadmin.
#
IceGridAdmin.Username=foo
IceGridAdmin.Password=bar
Loading
Loading