|
|
# The main config file
|
|
|
The main configuration file of a Cameo server is an XML file usually called *config.xml* but the name is not imposed. We already saw a minimal example where no application were registered. Let's discover the different options.
|
|
|
The main configuration file of a CAMEO server is an XML file usually called *config.xml* but the name is not imposed. We already saw a minimal example where no application were registered. Let's discover the different options.
|
|
|
|
|
|
Let's take an example with two applications registered:
|
|
|
```xml
|
... | ... | @@ -68,13 +68,13 @@ args | | The arguments passed to the execut |
|
|
|
|
|
The *start* tag is mandatory, the associated executable program is executed when a *start* is requested. The arguments *args* are first set then come the arguments passed to the *start* request and then the last argument is added if *info_arg* is *yes*.
|
|
|
|
|
|
When the *stop* tag is defined, a *stop* command is executed corresponding to the executable with the arguments *args*. It can be useful for programs that can be stopped nicely with a signal. However for managed Cameo apps, it is better to define a stop handler that is automatically triggered when a *stop* is requested.
|
|
|
When the *stop* tag is defined, a *stop* command is executed corresponding to the executable with the arguments *args*. It can be useful for programs that can be stopped nicely with a signal. However for managed CAMEO apps, it is better to define a stop handler that is automatically triggered when a *stop* is requested.
|
|
|
|
|
|
When the *error* tag is defined, an *error* command is executed when the application finishes with an error. That can be a segmentation fault for a C++ program or an exception for a Java program. In that case, the error can be processed e.g. analyze the generated core to send an email.
|
|
|
|
|
|
# Environment files
|
|
|
|
|
|
An application often depends on environment variables. When an application is launched on a local account, some specific environment variables may have been defined. However when the application is launched by a Cameo server, it may not work, because some environment variables are missing. Indeed the environment is not the one of the local account even if the Cameo server is launched as a user service. The *environment files* are there to solve this problem.
|
|
|
An application often depends on environment variables. When an application is launched on a local account, some specific environment variables may have been defined. However when the application is launched by a CAMEO server, it may not work, because some environment variables are missing. Indeed the environment is not the one of the local account even if the Cameo server is launched as a user service. The *environment files* are there to solve this problem.
|
|
|
|
|
|
An example with the *app.properties* file:
|
|
|
```
|
... | ... | @@ -91,22 +91,22 @@ One practical way to check the required environment variables is to launch the a |
|
|
|
|
|
# Log
|
|
|
|
|
|
The Cameo server application is logging in the *cameo.log* file and it is also possible to log the standard error and output of the applications started by the Cameo server.
|
|
|
The CAMEO server application is logging in the *cameo.log* file and it is also possible to log the standard error and output of the applications started by the Cameo server.
|
|
|
|
|
|
Indeed when you need to debug an application, the standard error and output may be useful.
|
|
|
Cameo applications are started in background and it is possible to log the standard error and output. For that, you need to define the *log_directory* attribute of the application tag with a path that exists or the *default* value which is the location of the *cameo.log* file. Each running Cameo application has a unique id provided by the server and the produced log file is *<name>.<id>.log* for an app with the name *name* and id *id*. For instance it could be *App2.12.log*.
|
|
|
CAMEO applications are started in background and it is possible to log the standard error and output. For that, you need to define the *log_directory* attribute of the application tag with a path that exists or the *default* value which is the location of the *cameo.log* file. Each running Cameo application has a unique id provided by the server and the produced log file is *<name>.<id>.log* for an app with the name *name* and id *id*. For instance it could be *App2.12.log*.
|
|
|
|
|
|
# Start the server
|
|
|
|
|
|
Once the configuration file and its associated environment files have been defined, the Cameo server can be started. The server can be started directly in a shell however it is recommended to start it as a service. See the [Installation](Installation) page for more details.
|
|
|
Once the configuration file and its associated environment files have been defined, the CAMEO server can be started. The server can be started directly in a shell however it is recommended to start it as a service. See the [Installation](Installation) page for more details.
|
|
|
|
|
|
# Registered and unregistered apps
|
|
|
|
|
|
Cameo is very flexible and accepts different combinations for an application to be controlled by Cameo.
|
|
|
CAMEO is very flexible and accepts different combinations for an application to be controlled by Cameo.
|
|
|
|
|
|
## *This* initialized with the *arguments* variable
|
|
|
|
|
|
Usually to benefit from the Cameo services inside an application, the *This* object is initialized by passing the arguments of the program. In C++:
|
|
|
Usually to benefit from the CAMEO services inside an application, the *This* object is initialized by passing the arguments of the program. In C++:
|
|
|
```cpp
|
|
|
int main(int argc, char *argv[]) {
|
|
|
|
... | ... | @@ -133,13 +133,13 @@ import cameopy |
|
|
cameopy.This.init(sys.argv)
|
|
|
```
|
|
|
|
|
|
Once *This* is initialized it can be used for example to get a reference to the Cameo server that started it. When *This* is initialized with the *arguments* variable, there are two cases:
|
|
|
Once *This* is initialized it can be used for example to get a reference to the CAMEO server that started it. When *This* is initialized with the *arguments* variable, there are two cases:
|
|
|
* **Registered application**: If the application is registered in the configuration file, then *info_arg* must be *yes* which is the default value so it is not necessary to specify it. Otherwise the application will not start.
|
|
|
* **Not registered application**: If the application is not registered in the configuration file, it is possible to start directly the app by adding a last argument that contains the Cameo server reference and its name. For instance:
|
|
|
* **Not registered application**: If the application is not registered in the configuration file, it is possible to start directly the app by adding a last argument that contains the CAMEO server reference and its name. For instance:
|
|
|
```
|
|
|
$ /users/ics/app1 "{\"name\":\"App1\", \"server\":\"tcp://localhost:10000\"}"
|
|
|
```
|
|
|
Then if the passed arguments are correct, *This* will initialize and the application will become **attached** to the Cameo server referenced by the endpoint in the *server* member.
|
|
|
Then if the passed arguments are correct, *This* will initialize and the application will become **attached** to the CAMEO server referenced by the endpoint in the *server* member.
|
|
|
|
|
|
## *This* initialized with explicit arguments
|
|
|
|
... | ... | @@ -190,14 +190,14 @@ The reason is because the underlying process execution works not well when the e |
|
|
|
|
|
# Ports
|
|
|
|
|
|
The implementation of a Cameo server is based on ZeroMQ and a sockets of different types are open. Here are the different ports:
|
|
|
The implementation of a CAMEO server is based on ZeroMQ and a sockets of different types are open. Here are the different ports:
|
|
|
* The base port: This is the port of the server endpoint. By default it is 7000 but it can be defined by the *port* attribute in the configuration file.
|
|
|
* The status port: This is the port from which are published the events of status of the different running applications.
|
|
|
* The stream ports: Each application for which the attribute *stream* is set to *yes* publishes the standard error and output on a stream port.
|
|
|
* The coms ports: We will see later that the provided coms also use some ports for their implementation.
|
|
|
* The proxy ports: The ports used by the proxies. See section [Use the proxies with a firewall](Use-the-proxies-with-a-firewall) for more details.
|
|
|
|
|
|
Except the base port and the proxy ports that are fixed, all the other ports are **dynamically assigned**. Right now the Cameo server does not check if the port it assigns has already been assigned by an external program, however it is planned to be.
|
|
|
Except the base port and the proxy ports that are fixed, all the other ports are **dynamically assigned**. Right now the CAMEO server does not check if the port it assigns has already been assigned by an external program, however it is planned to be.
|
|
|
|
|
|
# Stop and error executables
|
|
|
|
... | ... | |