# OSHA OiRA Statistics Deployment
This package contains configuration and scripts for deploying the OSHA OiRA statistics. The buildout configuration sets up a number of metabase instances to serve the statistics and generates scripts to manage them.
# Setup
## Quickstart
Create a `buildout.cfg` like this:
[buildout]
extends =
base.cfg
secrets.cfg
[secrets]
<= secrets-production
Run
# make
## Installation / Update
### One-Shot
If you're installing for the first time, you need to make sure the databases are created (see below). If you're updating an existing installation, it's usually enough to call
# make
or, equivalently,
# make all
This sets up everything in one go except for creating the databases - you may need to do this as a privileged user, and it's unnecessary to run on every update, so it's not included by default. See "Creating the Databases" for instructions.
### Step-By-Step
If the one-shot setup fails for some reason or you're interested in the details, read on for a step-by-step setup.
If you're in an environment with managed secrets, decrypt the secrets file with:
# gpg -d secrets.cfg.gpg > secrets.cfg
Create a `buildout.cfg` that extends `base.cfg` and, if you're using it, `secrets.cfg`.
[buildout]
extends =
base.cfg
secrets.cfg
Make sure that there is a secrets section in your `buildout.cfg` and that it inherits from the correct section in `secrets.cfg.gpg`:
[secrets]
<= secrets-production
Otherwise set the passwords manually:
[secrets]
metabase-password = secret
ldap-password = secret
If you want to bind to a different address than `localhost`, set the `metabase-host`:
[metabase-instance]
metabase-host = oira.local
Then, as usual, run:
# bin/buildout
Alternatively, decrypting and running buildout is done by
# make buildout
### Creating the Databases
During the first setup or if you get an error like
psql: FATAL: database "xyz" does not exist
you will need to initialize the postgresql databases. Make sure
* buildout has run sucessfully (`make buildout` or `bin/buildout`)
* `PSQL_USER` (see Makefile) is set to a user who may create postgresql databases
* your current user can use sudo to become `PSQL_USER`
Once you're set, run
# make create-databases
or, if you're already logged in as an appropriate user
# psql -U postgres < scripts/create-databases.sql
and then retry `make all`.
# Usage
## Getting started
If you've run `make all` successfully, you can skip this section.
To set up the metabase instances:
# bin/init-metabase
or
# make init-metabase
This calls `bin/init-metabase-instance` (see below) for all instances with the parameters specified in the corresponding buildout sections.
After that you can log in to the metabase instances with the credentials you provided in the buildout configuration.
## Making changes
To make changes to the metabase content, modify the data in oira.statistics.deployment.content. It may be convenient to make changes via the UI and then get the corresponding values via the API. You can use the `ipybase` shell defined in devel.cfg for this purpose.
To apply the changes to the global and country instances, again run
# bin/init-metabase
## init-metabase-instance
Applies settings to a single metabase instance. Sets database connection parameters and optionally creates an additional user. Run `init-metabase-instance --help` for arguments.
## init-metabase
Initializes all metabase instances by dropping all database content and running
init-metabase-instance on each of them. Does not take any parameters; buildout writes
them directly into the script. If the environment variable `SKIP_DB_RESTORE` is set, database contents are not dropped but kept.
Changelog
=========
1.0.0 (2024-06-13)
------------------
* Initial release
Raw data
{
"_id": null,
"home_page": "http://www.oiraproject.eu/",
"name": "oira.statistics.deployment",
"maintainer": null,
"docs_url": null,
"requires_python": "~=3.8",
"maintainer_email": null,
"keywords": "euphorie osha oira",
"author": "syslab.com",
"author_email": "info@syslab.com",
"download_url": "https://files.pythonhosted.org/packages/cd/e6/b9200a33cc5c508cd49b81fd8b0dd82d14acb601e8eba0cdc84fa171dbb6/oira.statistics.deployment-1.0.0.tar.gz",
"platform": null,
"description": "# OSHA OiRA Statistics Deployment\n\nThis package contains configuration and scripts for deploying the OSHA OiRA statistics. The buildout configuration sets up a number of metabase instances to serve the statistics and generates scripts to manage them.\n\n# Setup\n\n## Quickstart\n\nCreate a `buildout.cfg` like this:\n\n [buildout]\n extends =\n base.cfg\n secrets.cfg\n\n [secrets]\n <= secrets-production\n\nRun\n\n # make\n\n\n## Installation / Update\n\n### One-Shot\n\nIf you're installing for the first time, you need to make sure the databases are created (see below). If you're updating an existing installation, it's usually enough to call\n\n # make\n\nor, equivalently,\n\n # make all\n\nThis sets up everything in one go except for creating the databases - you may need to do this as a privileged user, and it's unnecessary to run on every update, so it's not included by default. See \"Creating the Databases\" for instructions.\n\n### Step-By-Step\n\nIf the one-shot setup fails for some reason or you're interested in the details, read on for a step-by-step setup.\n\nIf you're in an environment with managed secrets, decrypt the secrets file with:\n\n # gpg -d secrets.cfg.gpg > secrets.cfg\n\nCreate a `buildout.cfg` that extends `base.cfg` and, if you're using it, `secrets.cfg`.\n\n [buildout]\n extends =\n base.cfg\n secrets.cfg\n\nMake sure that there is a secrets section in your `buildout.cfg` and that it inherits from the correct section in `secrets.cfg.gpg`:\n\n [secrets]\n <= secrets-production\n\nOtherwise set the passwords manually:\n\n [secrets]\n metabase-password = secret\n ldap-password = secret\n\nIf you want to bind to a different address than `localhost`, set the `metabase-host`:\n\n [metabase-instance]\n metabase-host = oira.local\n\nThen, as usual, run:\n\n # bin/buildout\n\nAlternatively, decrypting and running buildout is done by\n\n # make buildout\n\n### Creating the Databases\n\nDuring the first setup or if you get an error like\n\n psql: FATAL: database \"xyz\" does not exist\n\nyou will need to initialize the postgresql databases. Make sure\n\n* buildout has run sucessfully (`make buildout` or `bin/buildout`)\n* `PSQL_USER` (see Makefile) is set to a user who may create postgresql databases\n* your current user can use sudo to become `PSQL_USER`\n\nOnce you're set, run\n\n # make create-databases\n\nor, if you're already logged in as an appropriate user\n\n # psql -U postgres < scripts/create-databases.sql\n\nand then retry `make all`.\n\n# Usage\n\n## Getting started\n\nIf you've run `make all` successfully, you can skip this section.\n\nTo set up the metabase instances:\n\n # bin/init-metabase\n\nor\n\n # make init-metabase\n\nThis calls `bin/init-metabase-instance` (see below) for all instances with the parameters specified in the corresponding buildout sections.\n\nAfter that you can log in to the metabase instances with the credentials you provided in the buildout configuration.\n\n## Making changes\n\nTo make changes to the metabase content, modify the data in oira.statistics.deployment.content. It may be convenient to make changes via the UI and then get the corresponding values via the API. You can use the `ipybase` shell defined in devel.cfg for this purpose.\n\nTo apply the changes to the global and country instances, again run\n\n # bin/init-metabase\n\n## init-metabase-instance\n\nApplies settings to a single metabase instance. Sets database connection parameters and optionally creates an additional user. Run `init-metabase-instance --help` for arguments.\n\n## init-metabase\n\nInitializes all metabase instances by dropping all database content and running\ninit-metabase-instance on each of them. Does not take any parameters; buildout writes\nthem directly into the script. If the environment variable `SKIP_DB_RESTORE` is set, database contents are not dropped but kept.\n\nChangelog\n=========\n\n1.0.0 (2024-06-13)\n------------------\n\n* Initial release\n",
"bugtrack_url": null,
"license": "GPL",
"summary": "Deployment helpers for the statistics of the OSHA-OiRA site.",
"version": "1.0.0",
"project_urls": {
"Homepage": "http://www.oiraproject.eu/"
},
"split_keywords": [
"euphorie",
"osha",
"oira"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "9af72a075b179e1c53640da32240669ea8d317ee95da46c64ead74be7e46723e",
"md5": "6c915375bc33ce058ef946f78319fa26",
"sha256": "052c44d3d2c81cd933e0c97331bf20f7438b80dd733d4c14b10403c3a93d368a"
},
"downloads": -1,
"filename": "oira.statistics.deployment-1.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "6c915375bc33ce058ef946f78319fa26",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "~=3.8",
"size": 33152,
"upload_time": "2024-06-20T05:08:10",
"upload_time_iso_8601": "2024-06-20T05:08:10.625488Z",
"url": "https://files.pythonhosted.org/packages/9a/f7/2a075b179e1c53640da32240669ea8d317ee95da46c64ead74be7e46723e/oira.statistics.deployment-1.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "cde6b9200a33cc5c508cd49b81fd8b0dd82d14acb601e8eba0cdc84fa171dbb6",
"md5": "20ae43822f00eb92f680d446f3b152f6",
"sha256": "2d0b7e2f09fc060ea5825ee43a066f0af248a7eadece2462afd1b47d2d903672"
},
"downloads": -1,
"filename": "oira.statistics.deployment-1.0.0.tar.gz",
"has_sig": false,
"md5_digest": "20ae43822f00eb92f680d446f3b152f6",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "~=3.8",
"size": 659650,
"upload_time": "2024-06-20T05:08:15",
"upload_time_iso_8601": "2024-06-20T05:08:15.349419Z",
"url": "https://files.pythonhosted.org/packages/cd/e6/b9200a33cc5c508cd49b81fd8b0dd82d14acb601e8eba0cdc84fa171dbb6/oira.statistics.deployment-1.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-06-20 05:08:15",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "oira.statistics.deployment"
}