Skip to content

Commit

Permalink
change default port and update some doc
Browse files Browse the repository at this point in the history
  • Loading branch information
osallou committed Dec 6, 2017
1 parent 1ad859f commit c259cb2
Show file tree
Hide file tree
Showing 7 changed files with 144 additions and 103 deletions.
33 changes: 22 additions & 11 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Features
* On expiration date, delete the VM and send an email to user
* CLI commands to extend a VM or remove expiration from a VM (admin only)

configuration file can be specified via environement variable OSVMEXPIRE_CONFIG.

Development
-----------
Expand All @@ -31,7 +32,7 @@ Configuration

.. code-block:: bash
oslo-config-generator --namespace oslo.messaging --namespace osvmexpire.common.config --namespace keystonemiddleware.auth_token --namespace oslo.service.periodic_task --namespace oslo.service.service > etc/oslo-config-generator/osvmexpire.conf
oslo-config-generator --namespace oslo.db --namespace oslo.messaging --namespace osvmexpire.common.config --namespace keystonemiddleware.auth_token --namespace oslo.service.periodic_task --namespace oslo.service.service > etc/oslo-config-generator/osvmexpire.conf
oslopolicy-sample-generator --config-file etc/oslo-config-generator/policy.conf --format json
Create/Upgrade DB
Expand All @@ -57,15 +58,14 @@ For dev (port 8000)

.. code-block:: bash
export OSVMEXPIRE_PORT=9311 # optional
export OSVMEXPIRE_PORT=9411 # optional
osvmexpire-wsgi-api
For prod

.. code-block:: bash
# uwsgi --master --die-on-term --emperor /etc/os-vm-expire/vassals --logto /var/log/os-vm-expire/osvmexpire-api.log --stats localhost:9314
python bin/osvmexpire-api.py
uwsgi --master --die-on-term --emperor /etc/os-vm-expire/vassals --logto /var/log/os-vm-expire/osvmexpire-api.log --stats localhost:9314
Start worker
Expand All @@ -75,7 +75,7 @@ Manage nova notifications on instance creation and deletion to create/delete exp

.. code-block:: bash
osvmexpire-worker --config-file etc/os-vm-expire/osvmexpire.conf
osvmexpire-worker --config-file /etc/os-vm-expire/osvmexpire.conf
Start cleaner
Expand All @@ -88,11 +88,22 @@ Once expiration is reached (and if user could be notified of expiration), delete
osvmexpire-cleaner --config-file /etc/os-vm-expire/osvmexpire.conf
CLI usage
---------
CLI usage
---------

.. code-block:: bash
Those command-line tools need access to configuration file, so are dedicated to administer the tool, not for end user.

osvmexpire-manage db -h
osvmexpire-manage vm extend -h
osvmexpire-manage vm remove -h
.. code-block:: bash
osvmexpire-manage vm list
osvmexpire-manage vm extend -h
osvmexpire-manage vm remove -h
Credits
~~~~~~~

Code is mostly inspired (code base coming from) the Barbican Openstack project, code was more or less updated to manage different objects.
This project takes the same license and kept original file headers.

This project was developed by the GenOuest core facility, IRISA, France.
2 changes: 1 addition & 1 deletion bin/osvmexpire-api.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@


def run():
vmexpire_port = '9311'
vmexpire_port = '9411'
if 'OSVMEXPIRE_PORT' in os.environ:
vmexpire_port = os.environ['OSVMEXPIRE_PORT']

Expand Down
8 changes: 4 additions & 4 deletions doc/source/install/common_configure.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,24 +27,24 @@
# would be the load balanced endpoint that clients would use to
# communicate back with this service. If a deployment wants to derive
# host from wsgi request instead then make this blank. Blank is needed
# to override default config value which is 'http://localhost:9311'
# to override default config value which is 'http://localhost:9411'
# (string value)
host_href = http://localhost:9311
host_href = http://localhost:9411
# Maximum life duration of VM in days (integer value)
#max_vm_duration = 60
# Maximum life extend of VM in days (integer value)
#max_vm_extend = 30
[database]
# SQLAlchemy connection string for the reference implementation
# registry server. Any valid SQLAlchemy connection string is fine.
# See:
# http://www.sqlalchemy.org/docs/05/reference/sqlalchemy/connections.html#sqlalchemy.create_engine.
# Note: For absolute addresses, use '////' slashes after 'sqlite:'.
# (string value)
sql_connection=mysql+mysqldb://os_vm_expire:dbpassword@localhost/os_vm_expire
connection=mysql+pysql://os_vm_expire:dbpassword@localhost/os_vm_expire
[keystone_authtoken]
auth_type = password
Expand Down
2 changes: 1 addition & 1 deletion etc/os-vm-expire/vassals/osvmexpire-api.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[uwsgi]
socket = :9311
socket = :9411
protocol = http
processes = 1
lazy = true
Expand Down
197 changes: 113 additions & 84 deletions etc/oslo-config-generator/osvmexpire.conf
Original file line number Diff line number Diff line change
Expand Up @@ -255,91 +255,9 @@
# would be the load balanced endpoint that clients would use to
# communicate back with this service. If a deployment wants to derive
# host from wsgi request instead then make this blank. Blank is needed
# to override default config value which is 'http://localhost:9311'
# to override default config value which is 'http://localhost:9411'
# (string value)
#host_href = http://localhost:9311

# SQLAlchemy connection string for the reference implementation
# registry server. Any valid SQLAlchemy connection string is fine.
# See:
# http://www.sqlalchemy.org/docs/05/reference/sqlalchemy/connections.html#sqlalchemy.create_engine.
# Note: For absolute addresses, use '////' slashes after 'sqlite:'.
# (string value)
#sql_connection = sqlite:///osvmexpire.sqlite

# Period in seconds after which SQLAlchemy should reestablish its
# connection to the database. MySQL uses a default `wait_timeout` of 8
# hours, after which it will drop idle connections. This can result in
# 'MySQL Gone Away' exceptions. If you notice this, you can lower this
# value to ensure that SQLAlchemy reconnects before MySQL can drop the
# connection. (integer value)
#sql_idle_timeout = 3600

# Maximum number of database connection retries during startup. Set to
# -1 to specify an infinite retry count. (integer value)
#sql_max_retries = 60

# Interval between retries of opening a SQL connection. (integer
# value)
#sql_retry_interval = 1

# Create the osvmexpire database on service startup. (boolean value)
#db_auto_create = true

# Maximum page size for the 'limit' paging URL parameter. (integer
# value)
#max_limit_paging = 100

# Default page size for the 'limit' paging URL parameter. (integer
# value)
#default_limit_paging = 10

# Accepts a class imported from the sqlalchemy.pool module, and
# handles the details of building the pool for you. If commented out,
# SQLAlchemy will select based on the database dialect. Other options
# are QueuePool (for SQLAlchemy-managed connections) and NullPool (to
# disabled SQLAlchemy management of connections). See
# http://docs.sqlalchemy.org/en/latest/core/pooling.html for more
# details (string value)
#sql_pool_class = QueuePool

# Show SQLAlchemy pool-related debugging output in logs (sets DEBUG
# log level output) if specified. (boolean value)
#sql_pool_logging = false

# Size of pool used by SQLAlchemy. This is the largest number of
# connections that will be kept persistently in the pool. Can be set
# to 0 to indicate no size limit. To disable pooling, use a NullPool
# with sql_pool_class instead. Comment out to allow SQLAlchemy to
# select the default. (integer value)
#sql_pool_size = 5

# # The maximum overflow size of the pool used by SQLAlchemy. When the
# number of checked-out connections reaches the size set in
# sql_pool_size, additional connections will be returned up to this
# limit. It follows then that the total number of simultaneous
# connections the pool will allow is sql_pool_size +
# sql_pool_max_overflow. Can be set to -1 to indicate no overflow
# limit, so no limit will be placed on the total number of concurrent
# connections. Comment out to allow SQLAlchemy to select the default.
# (integer value)
#sql_pool_max_overflow = 10

# Enable eventlet backdoor. Acceptable values are 0, <port>, and
# <start>:<end>, where 0 results in listening on a random tcp port
# number; <port> results in listening on the specified port number
# (and not enabling backdoor if that port is in use); and
# <start>:<end> results in listening on the smallest unused port
# number within the specified range of port numbers. The chosen port
# is displayed in the service's log file. (string value)
#backdoor_port = <None>

# Enable eventlet backdoor, using the provided path as a unix socket
# that can receive connections. This option is mutually exclusive with
# 'backdoor_port' in that only one should be provided. If both are
# provided then the existence of this option overrides the usage of
# that option. (string value)
#backdoor_socket = <None>
#host_href = http://localhost:9411


[cleaner]
Expand Down Expand Up @@ -1423,3 +1341,114 @@

# SMTP From origin (string value)
#email_smtp_from = <None>


[database]

#
# From oslo.db
#

# If True, SQLite uses synchronous mode. (boolean value)
#sqlite_synchronous = true

# The back end to use for the database. (string value)
# Deprecated group/name - [DEFAULT]/db_backend
#backend = sqlalchemy

# The SQLAlchemy connection string to use to connect to the database.
# (string value)
# Deprecated group/name - [DEFAULT]/sql_connection
# Deprecated group/name - [DATABASE]/sql_connection
# Deprecated group/name - [sql]/connection
#connection = <None>

# The SQLAlchemy connection string to use to connect to the slave
# database. (string value)
#slave_connection = <None>

# The SQL mode to be used for MySQL sessions. This option, including
# the default, overrides any server-set SQL mode. To use whatever SQL
# mode is set by the server configuration, set this to no value.
# Example: mysql_sql_mode= (string value)
#mysql_sql_mode = TRADITIONAL

# If True, transparently enables support for handling MySQL Cluster
# (NDB). (boolean value)
#mysql_enable_ndb = false

# Connections which have been present in the connection pool longer
# than this number of seconds will be replaced with a new one the next
# time they are checked out from the pool. (integer value)
# Deprecated group/name - [DATABASE]/idle_timeout
# Deprecated group/name - [database]/idle_timeout
# Deprecated group/name - [DEFAULT]/sql_idle_timeout
# Deprecated group/name - [DATABASE]/sql_idle_timeout
# Deprecated group/name - [sql]/idle_timeout
#connection_recycle_time = 3600

# Minimum number of SQL connections to keep open in a pool. (integer
# value)
# Deprecated group/name - [DEFAULT]/sql_min_pool_size
# Deprecated group/name - [DATABASE]/sql_min_pool_size
#min_pool_size = 1

# Maximum number of SQL connections to keep open in a pool. Setting a
# value of 0 indicates no limit. (integer value)
# Deprecated group/name - [DEFAULT]/sql_max_pool_size
# Deprecated group/name - [DATABASE]/sql_max_pool_size
#max_pool_size = 5

# Maximum number of database connection retries during startup. Set to
# -1 to specify an infinite retry count. (integer value)
# Deprecated group/name - [DEFAULT]/sql_max_retries
# Deprecated group/name - [DATABASE]/sql_max_retries
#max_retries = 10

# Interval between retries of opening a SQL connection. (integer
# value)
# Deprecated group/name - [DEFAULT]/sql_retry_interval
# Deprecated group/name - [DATABASE]/reconnect_interval
#retry_interval = 10

# If set, use this value for max_overflow with SQLAlchemy. (integer
# value)
# Deprecated group/name - [DEFAULT]/sql_max_overflow
# Deprecated group/name - [DATABASE]/sqlalchemy_max_overflow
#max_overflow = 50

# Verbosity of SQL debugging information: 0=None, 100=Everything.
# (integer value)
# Minimum value: 0
# Maximum value: 100
# Deprecated group/name - [DEFAULT]/sql_connection_debug
#connection_debug = 0

# Add Python stack traces to SQL as comment strings. (boolean value)
# Deprecated group/name - [DEFAULT]/sql_connection_trace
#connection_trace = false

# If set, use this value for pool_timeout with SQLAlchemy. (integer
# value)
# Deprecated group/name - [DATABASE]/sqlalchemy_pool_timeout
#pool_timeout = <None>

# Enable the experimental use of database reconnect on connection
# lost. (boolean value)
#use_db_reconnect = false

# Seconds between retries of a database transaction. (integer value)
#db_retry_interval = 1

# If True, increases the interval between retries of a database
# operation up to db_max_retry_interval. (boolean value)
#db_inc_retry_interval = true

# If db_inc_retry_interval is set, the maximum seconds between retries
# of a database operation. (integer value)
#db_max_retry_interval = 10

# Maximum retries in case of connection error or deadlock error before
# error is raised. Set to -1 to specify an infinite retry count.
# (integer value)
#db_max_retries = 20
4 changes: 2 additions & 2 deletions os_vm_expire/common/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,14 +171,14 @@
]

host_opts = [
cfg.StrOpt('host_href', default='http://localhost:9311',
cfg.StrOpt('host_href', default='http://localhost:9411',
help=u._("Host name, for use in HATEOAS-style references Note: "
"Typically this would be the load balanced endpoint "
"that clients would use to communicate back with this "
"service. If a deployment wants to derive host from "
"wsgi request instead then make this blank. Blank is "
"needed to override default config value which is "
"'http://localhost:9311'")),
"'http://localhost:9411'")),
]


Expand Down
1 change: 1 addition & 0 deletions test-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ oslotest>=1.10.0 # Apache-2.0
stestr>=1.0.0 # Apache-2.0
testtools>=1.4.0 # MIT
openstackdocstheme>=1.11.0 # Apache-2.0
os-api-ref
# releasenotes
reno>=1.8.0 # Apache-2.0

0 comments on commit c259cb2

Please sign in to comment.