devpi-standalone
Example:
# Install the devpi service, incl. Nginx reverse proxy and https certificate. - devpi-standalone: host: dev.frkl.io email: [email protected] use_https: true user: devpi
Description
This frecklet installs a complete nginx-proxied devpi server.
If a backup_archive_file
is provided, it will be uploaded to the server, unarchived, and the backed-up
state will be imported before the server will be started for the first time. Check the frecklet::devpi-create-backup
frecklet for details about creating such a backup archive file. The import will take a minute or two, as it also
(re-)creates the pypi mirror index.
If the use_https
variable is set, a certificate from LetsEncrypt will be requrested and installed, along
with a cron job to automatically renew it before it expires. Nginx will be
configured to redirect all http traffic to https.
Resources
Variables
Name | Type | Default | Description |
---|---|---|---|
|
string | -- | If a password is already set, this will fail and the error will be ignored. |
|
string | -- | If this is not provided, a normal, 'empty' devpi instance will be created. |
|
string | -- | The email address to use with letsencrypt. |
|
string | localhost | The hostname of the server. |
|
boolean | False | "Whether to use the letsencrypt staging server. This is useful for developing -- the letsencrypt production server only allows a few requests per day. This option is disabled in the cli, as it is not used very often. Just use an overlay dict to enable this. |
|
boolean | -- | Request a lets-encrypt certificate and serve devpi via https (needs email-address). |
|
string | devpi | The user to run devpi as well as nginx. |
Examples
Example 1
Install the devpi service, incl. Nginx reverse proxy and https certificate.
Code
- devpi-standalone: host: dev.frkl.io email: [email protected] use_https: true user: devpi
Example 2
Re-create a devpi service instance from a backup, incl. Nginx reverse proxy and https certificate.
Code
- devpi-standalone: host: dev.frkl.io email: [email protected] use_https: true user: devpi backup_archive_file: ~/backups/devpi_backup.tar.gz
Code
doc: short_help: installs a complete devpi server, including nginx proxy & lets-encrypt certs help: | This frecklet installs a complete nginx-proxied devpi server. If a ``backup_archive_file`` is provided, it will be uploaded to the server, unarchived, and the backed-up state will be imported before the server will be started for the first time. Check the frecklet::devpi-create-backup *frecklet* for details about creating such a backup archive file. The import will take a minute or two, as it also (re-)creates the pypi mirror index. If the ``use_https`` variable is set, a certificate from LetsEncrypt will be requrested and installed, along with a cron job to automatically renew it before it expires. Nginx will be configured to redirect all http traffic to https. references: freckfrackery.install-devpi Ansible role: https://gitlab.com/freckfrackery/freckfrackery.install-devpi examples: - title: Install the devpi service, incl. Nginx reverse proxy and https certificate. vars: host: dev.frkl.io email: [email protected] use_https: true user: devpi - title: Re-create a devpi service instance from a backup, incl. Nginx reverse proxy and https certificate. vars: host: dev.frkl.io email: [email protected] use_https: true user: devpi backup_archive_file: ~/backups/devpi_backup.tar.gz args: hostname: type: string default: localhost required: true doc: short_help: The hostname of the server. email: type: string doc: short_help: The email address to use with letsencrypt. required: false use_https: type: boolean required: false # dependencies: email doc: short_help: Request a lets-encrypt certificate and serve devpi via https (needs email-address). cli: is_flag: true user: doc: short_help: The user to run devpi as well as nginx. type: string required: false default: devpi cli: show_default: true letsencrypt_staging: doc: short_help: Whether to use the letsencrypt staging server. help: | "Whether to use the letsencrypt staging server. This is useful for developing -- the letsencrypt production server only allows a few requests per day. This option is disabled in the cli, as it is not used very often. Just use an overlay dict to enable this. type: boolean required: false default: false backup_archive_file: doc: short_help: A file to restore the service from. help: | If this is not provided, a normal, 'empty' devpi instance will be created. type: string required: false admin_password: type: string required: false secret: true doc: short_help: The initial admin password. help: | If a password is already set, this will fail and the error will be ignored. # use_basic_auth: # doc: # short_help: "Whether to setup basic auth." # type: boolean # required: false # default: false # cli: # enabled: false # basic_auth_message: # doc: # short_help: "The message that will be displayed to the user." # help: | # The message that will be displayed to the user. # type: string # empty: false # required: false # default: "Please authenticate." # basic_auth_users: # doc: # short_help: "A dict with username as key, password as value." # type: dict # required: false # cli: # enabled: false # basic_auth_user_file: # doc: # short_help: "The file to store htpasswd information." # type: string # required: false # default: "/etc/htpasswd" # cli: # show_default: true # enabled: false meta: tags: - devpi - python - repository - packages - setup frecklets: - devpi-service: user: '{{:: user ::}}' admin_password: '{{:: admin_password ::}}' backup_archive_file: '{{:: backup_archive_file ::}}' - devpi-nginx-vhost-config: path: /etc/nginx/sites-enabled/vhost_devpi.conf owner: '{{:: user ::}}' host: '{{:: hostname ::}}' devpi_root: /home/devpi/.devpi/server devpi_host: localhost devpi_port: 3141 devpi_proto: http use_https: '{{:: use_https ::}}' - webserver-service: webserver: nginx letsencrypt_webroot: /home/devpi/.devpi/server use_https: '{{:: use_https | default(false) ::}}' letsencrypt_email: '{{:: email ::}}' letsencrypt_staging: '{{:: letsencrypt_staging ::}}' letsencrypt_domains: - '{{:: hostname ::}}' webserver_user: devpi
frecklecute devpi-standalone --help Usage: frecklecute devpi-standalone [OPTIONS] This frecklet installs a complete nginx-proxied devpi server. If a ``backup_archive_file`` is provided, it will be uploaded to the server, unarchived, and the backed-up state will be imported before the server will be started for the first time. Check the frecklet::devpi- create-backup *frecklet* for details about creating such a backup archive file. The import will take a minute or two, as it also (re-)creates the pypi mirror index. If the ``use_https`` variable is set, a certificate from LetsEncrypt will be requrested and installed, along with a cron job to automatically renew it before it expires. Nginx will be configured to redirect all http traffic to https. Options: --admin-password ADMIN_PASSWORD The initial admin password. --backup-archive-file BACKUP_ARCHIVE_FILE A file to restore the service from. --email EMAIL The email address to use with letsencrypt. --hostname HOSTNAME The hostname of the server. --letsencrypt-staging / --no-letsencrypt-staging Whether to use the letsencrypt staging server. --use-https / --no-use-https Request a lets-encrypt certificate and serve devpi via https (needs email-address). --user USER The user to run devpi as well as nginx. --help Show this message and exit.
# -*- coding: utf-8 -*- # # module path: pycklets.devpi_standalone.DevpiStandalone # from dataclasses import dataclass from pyckles import AutoPycklet from typing import * # noqa @dataclass class DevpiStandalone(AutoPycklet): """This frecklet installs a complete nginx-proxied devpi server. If a ``backup_archive_file`` is provided, it will be uploaded to the server, unarchived, and the backed-up state will be imported before the server will be started for the first time. Check the frecklet::devpi-create-backup *frecklet* for details about creating such a backup archive file. The import will take a minute or two, as it also (re-)creates the pypi mirror index. If the ``use_https`` variable is set, a certificate from LetsEncrypt will be requrested and installed, along with a cron job to automatically renew it before it expires. Nginx will be configured to redirect all http traffic to https. Args: admin_password: The initial admin password. backup_archive_file: A file to restore the service from. email: The email address to use with letsencrypt. hostname: The hostname of the server. letsencrypt_staging: Whether to use the letsencrypt staging server. use_https: Request a lets-encrypt certificate and serve devpi via https (needs email-address). user: The user to run devpi as well as nginx. """ FRECKLET_ID = "devpi-standalone" admin_password: str = None backup_archive_file: str = None email: str = None hostname: str = None letsencrypt_staging: bool = None use_https: bool = None user: str = None def __post_init__(self): super(DevpiStandalone, self).__init__(var_names=["admin_password", "backup_archive_file", "email", "hostname", "letsencrypt_staging", "use_https", "user"]) frecklet_class = DevpiStandalone
# -*- coding: utf-8 -*- # # module path: pycklets.devpi_standalone.DevpiStandalone # from pyckles import AutoPycklet class DevpiStandalone(AutoPycklet): """This frecklet installs a complete nginx-proxied devpi server. If a ``backup_archive_file`` is provided, it will be uploaded to the server, unarchived, and the backed-up state will be imported before the server will be started for the first time. Check the frecklet::devpi-create-backup *frecklet* for details about creating such a backup archive file. The import will take a minute or two, as it also (re-)creates the pypi mirror index. If the ``use_https`` variable is set, a certificate from LetsEncrypt will be requrested and installed, along with a cron job to automatically renew it before it expires. Nginx will be configured to redirect all http traffic to https. Args: admin_password: The initial admin password. backup_archive_file: A file to restore the service from. email: The email address to use with letsencrypt. hostname: The hostname of the server. letsencrypt_staging: Whether to use the letsencrypt staging server. use_https: Request a lets-encrypt certificate and serve devpi via https (needs email-address). user: The user to run devpi as well as nginx. """ FRECKLET_ID = "devpi-standalone" def __init__(self, admin_password=None, backup_archive_file=None, email=None, hostname="localhost", letsencrypt_staging=None, use_https=None, user="devpi"): super(DevpiStandalone, self).__init__(var_names=["admin_password", "backup_archive_file", "email", "hostname", "letsencrypt_staging", "use_https", "user"]) self._admin_password = admin_password self._backup_archive_file = backup_archive_file self._email = email self._hostname = hostname self._letsencrypt_staging = letsencrypt_staging self._use_https = use_https self._user = user @property def admin_password(self): return self._admin_password @admin_password.setter def admin_password(self, admin_password): self._admin_password = admin_password @property def backup_archive_file(self): return self._backup_archive_file @backup_archive_file.setter def backup_archive_file(self, backup_archive_file): self._backup_archive_file = backup_archive_file @property def email(self): return self._email @email.setter def email(self, email): self._email = email @property def hostname(self): return self._hostname @hostname.setter def hostname(self, hostname): self._hostname = hostname @property def letsencrypt_staging(self): return self._letsencrypt_staging @letsencrypt_staging.setter def letsencrypt_staging(self, letsencrypt_staging): self._letsencrypt_staging = letsencrypt_staging @property def use_https(self): return self._use_https @use_https.setter def use_https(self, use_https): self._use_https = use_https @property def user(self): return self._user @user.setter def user(self, user): self._user = user frecklet_class = DevpiStandalone