No matter what operating system the Gateway service daemon is running under, it will require a full configuration file, at a known location, that stores all of the settings that the service will need to know about when it starts up. The basic, Linux-flavored version of this configuration file (living in /etc/hms/hms_Gateway.conf on the target machine the service is running on) looks very much like the bare-bones example used in the Message-Queue implementation with RabbitMQ section of Chapter 16, The Artisan Gateway Service:
# HMS Artisan Gateway Service Configuration # - Used by the hms_Gateway.daemons.ArtisanGatewayDaemon class # to launch an active instance of the service logging: format: "%(asctime)s - %(name)s - %(levelname)s - %(message)s" name: hms_Gateway # If console-logging is desired, uncomment these lines # console: # level: info file: level: error logfile: "/var/log/hms/hms_Gateway.log" queue: type: rabbit connection: host: rabbitmq.hms.com port: 5672 path: / queue_name: "central-office" # Signing-key should be generated and added to configuration # during installation. It should be a 64-character, # bytes-type-compatible string-value, and will likely need to be # explicitly quoted signing_key: ""
This config file is intentionally not part of the packaging process—otherwise, every time an update was installed, there would be some risk of overwriting an existing and operational configuration. Once the final configuration is in place, it should not need to be modified under any reasonably normal circumstances. The only difference between the Linux version of the configuration file and one that would be used on a Windows server is the log file path (logging:file:logfile), which would need to be pointed at a Windows filesystem path.
The service management options that we'll examine, under both Windows and Linux operating systems, allow a simple command-line execution to start the service daemon. Older Linux service management might require a separate, freestanding script in Bash or Python to bridge between the operating system's core functionality and the user's and system's interaction with it. With the advent of these more modern options, though, we can launch the service daemon on a production system in much the same way it was launched for testing during its development, by adding a few lines of code to the end of hms_Gateway/daemons.py:
if __name__ == '__main__': daemon = ArtisanGatewayDaemon('/etc/hms/hms_Gateway.conf') daemon.start()