Skip to content

Commit b5f8bbd

Browse files
committed
Add CMake files to remaining IceGrid demos
1 parent 853e7bc commit b5f8bbd

28 files changed

+403
-153
lines changed

cpp/IceBox/hello/README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,21 @@ To run this demo, open two terminal windows. In the first window:
1212
**Linux:**
1313

1414
```shell
15-
LD_LIBRARY_PATH=./build icebox --IceBox.Service.Hello="HelloService:create --Ice.Trace.Dispatch"
15+
export LD_LIBRARY_PATH=$(pwd/)build
16+
icebox --IceBox.Service.Hello="HelloService:create --Ice.Trace.Dispatch"
1617
```
1718

1819
**macOS:**
1920

2021
```shell
21-
DYLD_LIBRARY_PATH=./build icebox --IceBox.Service.Hello="HelloService:create --Ice.Trace.Dispatch"
22+
export DYLD_LIBRARY_PATH=$PWD/build
23+
icebox --IceBox.Service.Hello="HelloService:create --Ice.Trace.Dispatch"
2224
```
2325

2426
**Windows:**
2527

2628
```shell
27-
set PATH=%PATH%;./build/Release
29+
set PATH=%CD%\\build\\Release;%PATH%
2830
icebox --IceBox.Service.Hello="HelloService:create --Ice.Trace.Dispatch"
2931
```
3032

cpp/IceGrid/allocate/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ cmake -B build
99
cmake --build build --config Release
1010
```
1111

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

1414
Add the server build directory to the PATH environment variable:
1515

1616
**Linux/macOS:**
1717

1818
```shell
19-
export PATH=$(pwd)/build:$PATH
19+
export PATH=$PWD/build:$PATH
2020
```
2121

2222
**Windows:**
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
cmake_minimum_required(VERSION 3.16)
2+
3+
project(icegrid_custom_locator CXX)
4+
5+
include(../../cmake/common.cmake)
6+
7+
add_executable(client Client.cpp Hello.ice)
8+
slice2cpp_generate(client)
9+
target_link_libraries(client Ice::Ice)
10+
11+
add_executable(server Server.cpp HelloI.cpp HelloI.h Hello.ice)
12+
slice2cpp_generate(server)
13+
target_link_libraries(server Ice::Ice)
14+
15+
add_executable(locator Locator.cpp)
16+
target_link_libraries(locator Ice::Ice)

cpp/IceGrid/customLocator/README.md

Lines changed: 55 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,55 @@
1+
# IceGrid Custom Locator
2+
13
This demo shows how to implement a [custom locator][1] that delegates
24
to the [IceGrid][2] registry.
35

4-
To run the demo, first start the IceGrid service:
6+
To build the demo run:
7+
8+
```shell
9+
cmake -B build
10+
cmake --build build --config Release
11+
```
12+
13+
To run the demo, first open a new terminal window for the IceGrid service:
14+
15+
Add the server build directory to the PATH environment variable:
16+
17+
**Linux/macOS:**
518

19+
```shell
20+
export PATH=$PWD/build:$PATH
621
```
22+
23+
**Windows:**
24+
25+
```shell
26+
set PATH=%CD%\\build\\Release;%PATH%
27+
```
28+
29+
Now start the IceGrid service:
30+
31+
```shell
732
icegridnode --Ice.Config=config.grid
833
```
934

1035
In a separate window start the custom locator:
1136

37+
**Linux/macOS:**
38+
39+
```shell
40+
./build/locator
1241
```
13-
locator
42+
43+
**Windows:**
44+
45+
```shell
46+
build\Release\locator
1447
```
1548

1649
Now in another window deploy the application:
1750

18-
```
19-
icegridadmin --Ice.Config=config.grid -e "application add application.xml"
51+
```shell
52+
icegridadmin --Ice.Config=config.admin -e "application add application.xml"
2053
```
2154

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

2659
To run the client without setting this value:
2760

61+
**Linux/macOS:**
62+
63+
```shell
64+
./build/client
2865
```
29-
client
66+
67+
**Windows:**
68+
69+
```shell
70+
build\Release\client
3071
```
3172

3273
To run the client with the context set properly:
3374

75+
**Linux/macOS:**
76+
77+
```shell
78+
./build/client --context
3479
```
35-
client --context
80+
81+
**Windows:**
82+
83+
```shell
84+
build\Release\client --context
3685
```
3786

3887
[1]: https://doc.zeroc.com/ice/3.7/client-server-features/locators

cpp/IceGrid/customLocator/application.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<node name="node1">
88

9-
<server id="SimpleServer" exe="./server" activation="on-demand">
9+
<server id="SimpleServer" exe="server" activation="on-demand">
1010
<adapter name="Hello" endpoints="tcp -h localhost">
1111
<object identity="hello" type="::Demo::Hello" property="Identity"/>
1212
</adapter>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#
2+
# Dummy username and password for icegridadmin.
3+
#
4+
IceGridAdmin.Username=foo
5+
IceGridAdmin.Password=bar

cpp/IceGrid/customLocator/config.grid

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,3 @@ IceMX.Metrics.ByParent.Disabled=1
4646
IceGrid.Node.Trace.Activator=1
4747
#IceGrid.Node.Trace.Adapter=2
4848
#IceGrid.Node.Trace.Server=3
49-
50-
#
51-
# Dummy username and password for icegridadmin.
52-
#
53-
IceGridAdmin.Username=foo
54-
IceGridAdmin.Password=bar

cpp/IceGrid/icebox/CMakeLists.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
cmake_minimum_required(VERSION 3.16)
2+
3+
project(icegrid_icebox CXX)
4+
5+
include(../../cmake/common.cmake)
6+
7+
add_executable(client Client.cpp Hello.ice)
8+
slice2cpp_generate(client)
9+
target_link_libraries(client Ice::Ice Ice::IceGrid Ice::Glacier2)
10+
11+
add_library(HelloService SHARED HelloServiceI.cpp HelloServiceI.h HelloI.cpp HelloI.h Hello.ice)
12+
slice2cpp_generate(HelloService)
13+
target_link_libraries(HelloService Ice::Ice Ice::IceBox)

cpp/IceGrid/icebox/HelloServiceI.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
// Copyright (c) ZeroC, Inc.
22

3-
#include <HelloI.h>
4-
#include <HelloServiceI.h>
3+
#include "HelloI.h"
4+
#include "HelloServiceI.h"
5+
56
#include <Ice/Ice.h>
67

78
using namespace std;

cpp/IceGrid/icebox/README.md

Lines changed: 51 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# IceGrid IceBox
2+
13
This demo shows a very simple [IceGrid deployment][1], with a single
24
[IceBox][2] server hosting a number of IceBox services.
35

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

12-
Setup
13-
-----
14+
To build the demo run:
1415

15-
Start the IceGrid registry and node:
16-
```
17-
icegridnode --Ice.Config=config.grid
16+
```shell
17+
cmake -B build
18+
cmake --build build --config Release
1819
```
1920

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

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

29-
Using the IceGrid GUI
30-
---------------------
25+
Add the server build directory to the PATH environment variable:
3126

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

35-
- Launch the application. Windows users can use the IceGrid GUI
36-
icon from the Start menu, macOS users can use the IceGrid GUI
37-
icon from the Finder Applications folder, and users with a Linux
38-
installation can use the `icegridgui` script to start the
39-
program:
40-
```
41-
icegridgui
42-
```
29+
```shell
30+
export PATH=$PWD/build:$PATH
31+
export LD_LIBRARY_PATH=$PWD/build
32+
```
4333

44-
- Select `Login...` from the `File menu`.
34+
**macOS:**
4535

46-
- In the `Saved Connections` dialog, click `New Connection` to open
47-
the `New Connection` wizard.
36+
```shell
37+
export PATH=$PWD/build:$PATH
38+
export DYLD_LIBRARY_PATH=$PWD/build
39+
```
4840

49-
- Select `Direct Connection` and click `Next`.
41+
**Windows:**
5042

51-
- Let the default value `Connect to Master Registry` checked
52-
and click `Next`.
43+
```shell
44+
set PATH=%CD%\\build\\Release;%PATH%
45+
```
5346

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

57-
- In next Window let the pre fill `IceGrid Registry Endpoint(s)` and click
58-
`Next`.
49+
```shell
50+
icegridnode --Ice.Config=config.grid
51+
```
5952

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

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

66-
Running the Client
67-
------------------
60+
If you are using 32-bit binaries on a Linux 64-bit host, first edit
61+
`application.xml` and replace `exe="icebox"` by `exe="icebox32"`.
62+
63+
## Running the Client
64+
65+
To run the client type:
6866

69-
In a command window, start the client as shown below:
67+
**Linux/macOS:**
68+
69+
```shell
70+
./build/client
7071
```
71-
client
72+
73+
**Windows:**
74+
75+
```shell
76+
build\Release\client
7277
```
7378

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

76-
Stopping and restarting IceBox services
77-
---------------------------------------
81+
## Stopping and restarting IceBox services
7882

79-
You can use the IceGrid GUI or the command-line utility to stop and
83+
You can use the IceGrid GUI or the `icegridadmin` command-line utility to stop and
8084
restart IceBox services. The commands below show how to manipulate
8185
the 'Lisa' service:
82-
```
86+
87+
```shell
8388
icegridadmin --Ice.Config=config.grid
8489
>>> service stop IceBox Lisa
8590
>>> service start IceBox Lisa
8691
```
8792

88-
Administration through Glacier2
89-
-------------------------------
90-
91-
This demo also includes the configuration for a [Glacier2 router][4]
92-
to show how you could administer IceGrid from "the other side" of a firewall.
93-
(In this demo, however, all the components run on the same system.)
94-
95-
Follow these steps:
96-
97-
- Connect to the IceGrid registry with icegridadmin or the IceGrid GUI
98-
99-
- Start the DemoGlacier2 server
100-
101-
- Reconnect to the IceGrid registry, this time using a Glacier2
102-
session. For example, using the command-line utility you must
103-
supply a proxy for the router:
104-
105-
```
106-
icegridadmin --Ice.Default.Router="DemoGlacier2/router:tcp -h localhost -p 4063"
107-
```
108-
109-
In the IceGrid GUI, use the `Routed` tab of the `Login` dialog.
110-
Change the Glacier2 instance name to `DemoGlacier2` and the endpoints
111-
to `tcp -h localhost -p 4063`.
112-
113-
DemoGlacier2 is configured to use a built-in permissions verifier
114-
that does not validate passwords, so you can log in using any
115-
username/password combination.
116-
11793
[1]: https://doc.zeroc.com/ice/3.7/ice-services/icegrid/using-icegrid-deployment
11894
[2]: https://doc.zeroc.com/ice/3.7/icebox
119-
[3]: https://doc.zeroc.com/ice/3.7/ice-services/icegrid/icegrid-gui-tool
120-
[4]: https://doc.zeroc.com/ice/3.7/ice-services/glacier2/icegrid-and-glacier2-integration

0 commit comments

Comments
 (0)