Skip to content

Commit d48f97f

Browse files
committed
[300] Update section on running the server
1 parent 06a8ea5 commit d48f97f

File tree

1 file changed

+77
-24
lines changed

1 file changed

+77
-24
lines changed

docs/getting_started/running.md

Lines changed: 77 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,116 @@
11
#
22

3-
The iRODS Server can be run in one of three modes:
3+
## Starting the Server
44

5-
- [Syslog Mode](#syslog-mode)
6-
- [Standard Output Mode](#standard-output-mode)
7-
- [Test Mode](#test-mode)
5+
The iRODS server can be started in several ways, but the most common form is as a daemon process. This is accomplished by running the following as the service account user.
86

9-
## Syslog Mode
10-
This mode is the default when operating the iRODS Server.
7+
```bash
8+
irodsServer -d
9+
```
10+
11+
The server will perform various checks during startup to make sure it is safe to accept client requests. The most important check is validation of `server_config.json`. Failing validation will result in the server terminating immediately. All validation errors are reported via stderr.
12+
13+
Logs are written to syslog. See [The Server Log](../../system_overview/troubleshooting/#the-server-log) for information regarding syslog.
14+
15+
### Server PID File
16+
17+
By default, the server writes its process ID (PID) to `/var/run/irods/irods-server.pid`.
18+
19+
Use the `--pid-file` option to specify a different location. This is useful when running multiple iRODS servers on the same host.
20+
21+
## Stopping the Server
1122

12-
This mode instructs the server and all of its children to write log messages to **syslog**.
23+
iRODS supports two modes of shutdown.
1324

14-
syslog can be configured to write messages locally, remotely, or both.
25+
### Fast Shutdown
26+
27+
A fast shutdown is triggered by sending a `SIGTERM` or `SIGINT` to the main server process. For example:
1528

1629
```bash
17-
$ ./irodsctl start
30+
kill -TERM $(cat /var/run/irods/irods-server.pid)
1831
```
1932

20-
Messages can be rotated on a regular basis, most commonly through the **logrotate** service.
33+
This signal instructs agents to complete their current client request and terminate immediately (and cleanly), ending communication with the client.
34+
35+
### Graceful Shutdown
2136

22-
## Standard Output Mode
23-
This mode instructs the server and all of its children to write log messages to **stdout** instead of **syslog**. This mode can be enabled in two ways.
37+
A graceful shutdown is triggered by sending a `SIGQUIT` to the main server process. For example:
2438

25-
### Option 1 (recommended) - Use the control script in the iRODS service account
2639
```bash
27-
$ ./irodsctl start --stdout
40+
kill -QUIT $(cat /var/run/irods/irods-server.pid)
2841
```
2942

30-
### Option 2 - Launch the server binary directly
43+
This signal instructs agents to wait a limited amount of time before entering the [fast shutdown](#fast-shutdown) phase. During a graceful shutdown, agents will continue servicing client requests until the timeout. The timeout can be modified via the `graceful_shutdown_timeout_in_seconds` configuration property in `server_config.json`. See the section about [configuration](../../system_overview/configuration/#etcirodsserver_configjson) to learn more.
44+
45+
## Reloading Server Configuration
46+
47+
Unlike iRODS 4, iRODS 5 does not automatically load changes to `server_config.json`. Reloading the server's configuration requires sending a `SIGHUP` to the server. For example:
48+
3149
```bash
32-
$ /usr/sbin/irodsServer -u
50+
kill -HUP $(cat /var/run/irods/irods-server.pid)
3351
```
3452

35-
Regardless of the method, it is important to remember that once the server has been launched in this mode, the terminal will not return control until the server is shutdown or killed.
53+
On receiving `SIGHUP`, the server:
54+
55+
1. Validates `server_config.json` against its schema.
56+
2. If validation **fails**, the reload is **rejected** and the previous configuration is used.
57+
3. If validation **succeeds**, the server:
58+
59+
- Updates its in-memory configuration
60+
- Sends `SIGTERM` to the delay server (if running)
61+
- Sends `SIGQUIT` to the agent factory
62+
- Waits for the agent factory to close its listening socket
63+
- Launches a new agent factory
64+
65+
## Managing iRODS via the Service Manager
66+
67+
iRODS 5 has full compatibility with the service manager.
68+
69+
Given that systemd is the most widely used service manager, iRODS provides a service file template which should prove helpful to users looking to manage their iRODS server via systemd.
70+
71+
The service file template is located at `/var/lib/irods/packaging/irods.service.template`.
72+
73+
!!! Note
74+
As a best practice, prefer modifying a copy of the template files. Doing that will help with avoiding issues with upgrades. Template files should always be treated as readonly.
75+
76+
Configuring systemd to use the service file is out of scope for this documentation and is left as an exercise for the reader. Below are a few links which you may find helpful.
77+
78+
- <https://systemd.io>
79+
- <https://www.freedesktop.org/software/systemd/man/latest/systemd.html>
3680

3781
## Test Mode
82+
83+
!!! Note
84+
This section is primarily for developers working on the server, plugins, and/or clients.
85+
3886
This mode instructs the server to write all log messages to an additional log file. Messages will still be written to stdout or syslog depending on how the server was launched. This secondary log file is located at the following location:
87+
3988
```bash
4089
/var/lib/irods/log/test_mode_output.log
4190
```
4291

43-
This mode was introduced to guarantee that log messages appear in the log file immediately. This mode is only meant to be used for testing. The log file produced by this mode is never rotated.
92+
This mode was introduced to guarantee that log messages appear in the log file immediately. This mode is only meant to be used for testing. **The log file produced by this mode is never rotated.**
4493

4594
To enable this mode, you must first define the following environment variable in the iRODS service account:
95+
4696
```bash
4797
export IRODS_ENABLE_TEST_MODE=1
4898
```
49-
This environment variable instructs the IrodsController python class to start the server in test mode.
99+
100+
This environment variable makes various components (e.g. `IrodsController`) aware the server is to be operated in test mode. This is very important for tests which restart the server.
50101

51102
**If you are using the run_tests.py script to run tests, then you can ignore the rest of this section because run_tests.py restarts the server in test mode automatically.**
52103

53-
Next, you'll want to start (or restart) the server in test mode. This can be done using either of the following methods.
104+
Next, you'll want to start (or restart) the server in test mode.
54105

55-
### Option 1 (recommended) - Use the control script in the iRODS service account
56106
```bash
57-
$ ./irodsctl start --test
107+
irodsServer -t
58108
```
59109

60-
### Option 2 - Launch the server binary directly
110+
## Additional Information
111+
112+
For more options and information, see the server's built-in help:
113+
61114
```bash
62-
$ /usr/sbin/irodsServer -t
115+
irodsServer --help
63116
```

0 commit comments

Comments
 (0)