2
Copyright 2011 OpenStack, LLC
5
Licensed under the Apache License, Version 2.0 (the "License"); you may
6
not use this file except in compliance with the License. You may obtain
7
a copy of the License at
9
http://www.apache.org/licenses/LICENSE-2.0
11
Unless required by applicable law or agreed to in writing, software
12
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14
License for the specific language governing permissions and limitations
17
Controlling Glance Servers
18
==========================
20
This section describes the ways to start, stop, and reload Glance's server
26
There are two ways to start a Glance server (either the API server or the
27
reference implementation registry server that ships with Glance):
29
* Manually calling the server program
31
* Using the ``glance-control`` server daemon wrapper program
33
Manually starting the server
34
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
36
The first is by directly calling the server program, passing in command-line
37
options and a single argument for the ``paste.deploy`` configuration file to
38
use when configuring the server application.
42
Glance ships with an ``etc/`` directory that contains sample ``paste.deploy``
43
configuration files that you can copy to a standard configuation directory and
44
adapt for your own uses.
46
If you do `not` specifiy a configuration file on the command line, Glance will
47
do its best to locate a ``glance.conf`` configuration file in one of the
48
following directories, stopping at the first config file it finds:
60
If no configuration file is found, you will see any error, like so::
63
ERROR: Unable to locate any configuration file. Cannot load application glance-api
65
Here is an example showing how you can manually start the ``glance-api`` server
68
$> sudo glance-api etc/glance.conf.sample --debug
69
2011-02-09 14:58:29 DEBUG [glance-api] ********************************************************************************
70
2011-02-09 14:58:29 DEBUG [glance-api] Configuration options gathered from config file:
71
2011-02-09 14:58:29 DEBUG [glance-api] /home/jpipes/repos/glance/trunk/etc/glance.conf.sample
72
2011-02-09 14:58:29 DEBUG [glance-api] ================================================
73
2011-02-09 14:58:29 DEBUG [glance-api] bind_host 0.0.0.0
74
2011-02-09 14:58:29 DEBUG [glance-api] bind_port 9292
75
2011-02-09 14:58:29 DEBUG [glance-api] debug True
76
2011-02-09 14:58:29 DEBUG [glance-api] default_store file
77
2011-02-09 14:58:29 DEBUG [glance-api] filesystem_store_datadir /var/lib/glance/images/
78
2011-02-09 14:58:29 DEBUG [glance-api] registry_host 0.0.0.0
79
2011-02-09 14:58:29 DEBUG [glance-api] registry_port 9191
80
2011-02-09 14:58:29 DEBUG [glance-api] verbose False
81
2011-02-09 14:58:29 DEBUG [glance-api] ********************************************************************************
82
2011-02-09 14:58:29 DEBUG [routes.middleware] Initialized with method overriding = True, and path info altering = True
83
(16333) wsgi starting up on http://0.0.0.0:9292/
85
Simply supply the configuration file as the first argument
86
(``etc/glance.conf.sample`` in the above example) and then any common options
87
you want to use (``--debug`` was used above to show some of the debugging
88
output that the server shows when starting up. Call the server program
89
with ``--help`` to see all available options you can specify on the
92
For more information on configuring the server via the ``paste.deploy``
93
configuration files, see the section entitled
94
:doc:`Configuring Glance servers <configuring>`
96
Note that the server does not `daemonize` itself when run manually
97
from the terminal. You can force the server to daemonize using the standard
98
shell backgrounding indicator, ``&``. However, for most use cases, we recommend
99
using the ``glance-control`` server daemon wrapper for daemonizing. See below
100
for more details on daemonization with ``glance-control``.
102
Using the ``glance-control`` program to start the server
103
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
105
The second way to start up a Glance server is to use the ``glance-control``
106
program. ``glance-control`` is a wrapper script that allows the user to
107
start, stop, restart, and reload the other Glance server programs in
108
a fashion that is more conducive to automation and scripting.
110
Servers started via the ``glance-control`` program are always `daemonized`,
111
meaning that the server program process runs in the background.
113
To start a Glance server with ``glance-control``, simply call
114
``glance-control`` with a server and the word "start", followed by
115
any command-line options you wish to provide. Start the server with ``glance-control``
116
in the following way::
118
$> sudo glance-control <SERVER> start [CONFPATH]
122
You must use the ``sudo`` program to run ``glance-control`` currently, as the
123
pid files for the server programs are written to /var/run/glance/
125
Here is an example that shows how to start the ``glance-registry`` server
126
with the ``glance-control`` wrapper script. ::
128
$> sudo glance-control registry start etc/glance.conf.sample
129
Starting glance-registry with /home/jpipes/repos/glance/trunk/etc/glance.conf.sample
131
The same ``paste.deploy`` configuration files are used by ``glance-control``
132
to start the Glance server programs, and you can specify (as the example above
133
shows) a configuration file when starting the server.
137
To start all the Glance servers (currently the glance-api and glance-registry
138
programs) at once, you can specify "all" for the <SERVER>
143
If you started a Glance server manually and did not use the ``&`` backgrounding
144
function, simply send a terminate signal to the server process by typing
147
If you started the Glance server using the ``glance-control`` program, you can
148
use the ``glance-control`` program to stop it. Simply do the following::
150
$> sudo glance-control <SERVER> stop
152
as this example shows::
154
$> sudo glance-control registry stop
155
Stopping glance-registry pid: 17602 signal: 15
160
You can restart a server with the ``glance-control`` program, as demonstrated
163
$> sudo glance-control registry restart etc/glance.conf.sample
164
Stopping glance-registry pid: 17611 signal: 15
165
Starting glance-registry with /home/jpipes/repos/glance/trunk/etc/glance.conf.sample