Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MBS-10322: Drop Fabric #1337

Merged
merged 8 commits into from Jan 27, 2020
Merged

MBS-10322: Drop Fabric #1337

merged 8 commits into from Jan 27, 2020

Conversation

yvanzo
Copy link
Contributor

@yvanzo yvanzo commented Dec 20, 2019

Summary

Resolve MBS-10322: Port fabfile

Problem

fabfile.py was written for Fabric 1/Python 2 which is retiring in 2020. It was the only piece of Python in this repository, that doesn’t favor Fabric 2/Python 3 which is not 100% feature parity anyway. It was missing hosts discovery for deployment.

Solution

Rewriting tasks as independent scripts, with a few differences:

  • Scripts are self-documented (with HELP string)
  • More errors are handled and have detailed messages
  • Target hosts are deduced from docker server configs

TODO

  • Adding PROD_STANDY to DBDefs example/default
  • Adding MB_POT_DB to extract_pot_db
  • Completing update_potto check these parameters

@yvanzo yvanzo changed the title Drop Fabric MBS-10322: Drop Fabric Dec 31, 2019
@yvanzo
Copy link
Contributor Author

yvanzo commented Jan 8, 2020

  • Updated to support Mac OS X (bash 3 only, grep -E, sed -E)
  • Linted using shellcheck

@yvanzo yvanzo added this to the Tiburón Mamá milestone Jan 8, 2020
@yvanzo yvanzo marked this pull request as ready for review January 11, 2020 17:27
yvanzo added a commit to yvanzo/musicbrainz-docker that referenced this pull request Jan 11, 2020
- 172.17.0.1 is the default gateway of Docker bridge network
- 54321 is an arbitrary port for an SSH tunnel that can be created with:

    ssh -L 172.17.0.1:54321:localhost:65400 pink -N # production slave

It depends on metabrainz/musicbrainz-server#1337
po/update_translations.sh Outdated Show resolved Hide resolved
script/update_containers.sh Outdated Show resolved Hide resolved
script/update_containers.sh Outdated Show resolved Hide resolved
script/update_containers.sh Outdated Show resolved Hide resolved
script/database_exists Show resolved Hide resolved
po/update_pot.sh Outdated Show resolved Hide resolved
Copy link
Member

@mwiencek mwiencek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#1337 h4x

@yvanzo
Copy link
Contributor Author

yvanzo commented Jan 23, 2020

(Just rebased, no code change.)

@yvanzo
Copy link
Contributor Author

yvanzo commented Jan 27, 2020

Expanded update_containers.sh doc thanks to @reosarevok’s feedback.

yvanzo added a commit to yvanzo/musicbrainz-docker that referenced this pull request Jan 27, 2020
- 172.17.0.1 is the default gateway of Docker bridge network
- 54321 is an arbitrary port for an SSH tunnel that can be created with:

    ssh -L 172.17.0.1:54321:localhost:65400 pink -N # production slave

It depends on metabrainz/musicbrainz-server#1337
yvanzo and others added 8 commits January 27, 2020 22:02
Replace 'translations' Fabric task with '--commit' option to
'po/update_translations.sh' script.  Small changes in behavior:

- Prevent incidentally committing pre-existing local changes
- No more ask to confirm commit message before committing
- Show commit statistics if any, print a notice otherwise
Replace 'tag' Fabric task with new 'script/tag.sh'
Replace 'deploy' Fabric task with new 'script/update_containers.sh'.

Improvements:

- Automatically find hosts to be updated from docker server configs
- Less (1 instead of 3) ssh connections to each host to be updated
- Sleep more (30s instead of 15s) after each updated host
- Update services using script maintained with docker server configs
The script 'database_exists' assumes that all databases are on the same
host by using the database configuration 'SYSTEM' to query the table
'pg_database'.  However, this cannot be assumed with the new database
configuration 'PROD_STANDBY' which specifically points to another host.

This patch makes the script 'database_exists' use the tested database
configuration to query the table 'information_schema_catalog_name'.

Note: 'pg_database' may not be readable by user other than 'postgres'.
This controls which database in lib/DBDefs.pm is used to extract strings
from, defaulting to READWRITE as before.
Replace 'pot' Fabric task with new 'po/update_pot.sh' script and
'--commit' option. It is a derivative of 'po/update_translations.sh'
and has the same behavior:

- Prevent incidentally committing pre-existing local changes
- No more ask to confirm commit message before committing
- Show commit statistics if any, print a notice otherwise
- Test (remote) database connection before querying it

Plus, by Michael: Set MB_POT_DB=PROD_STANDBY in update_pot.sh

The intent of this script is to update pot files using the production
database, so the developer is now required to have a PROD_STANDBY
database configured in lib/DBDefs.pm which does that, via SSH tunnel or
otherwise.
Copy link
Member

@reosarevok reosarevok left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested for a test release, seemed to work fine.

@yvanzo yvanzo merged commit 2dc0354 into metabrainz:master Jan 27, 2020
@yvanzo yvanzo deleted the drop-fabric branch January 27, 2020 22:22
yvanzo added a commit to yvanzo/musicbrainz-server that referenced this pull request Jan 29, 2020
Since metabrainz#1337 replaced Fabric, `extract_pot_db` that requires Locale::PO
is no longer run in production, it is run in development setup instead.

This patch makes Locale::PO to be installed using cpanm option
`--with-develop` instead of `--with-feature=production`.
yvanzo added a commit to yvanzo/musicbrainz-docker that referenced this pull request Feb 14, 2020
- 172.17.0.1 is the default gateway of Docker bridge network
- 54321 is an arbitrary port for an SSH tunnel that can be created with:

    ssh -L 172.17.0.1:54321:localhost:65400 pink -N # production slave

It depends on metabrainz/musicbrainz-server#1337
yvanzo added a commit to yvanzo/musicbrainz-docker that referenced this pull request Feb 20, 2020
- 172.17.0.1 is the default gateway of Docker bridge network
- 54321 is an arbitrary port for an SSH tunnel that can be created with:

    ssh -L 172.17.0.1:54321:localhost:65400 pink -N # production slave

It depends on metabrainz/musicbrainz-server#1337
yvanzo added a commit to yvanzo/musicbrainz-docker that referenced this pull request Mar 19, 2020
- 172.17.0.1 is the default gateway of Docker bridge network
- 54321 is an arbitrary port for an SSH tunnel that can be created with:

    ssh -L 172.17.0.1:54321:localhost:65400 pink -N # production slave

It depends on metabrainz/musicbrainz-server#1337
yvanzo added a commit to yvanzo/musicbrainz-docker that referenced this pull request Mar 19, 2020
- 172.17.0.1 is the default gateway of Docker bridge network
- 54321 is an arbitrary port for an SSH tunnel that can be created with:

    ssh -L 172.17.0.1:54321:localhost:65400 pink -N # production slave

It depends on metabrainz/musicbrainz-server#1337
yvanzo added a commit to yvanzo/musicbrainz-docker that referenced this pull request Mar 20, 2020
This is a database definition for use by official maintainers only.

Note that standby/slave/secondary database is read-only anyway, thus
setting user to `musicbrainz` or musicbrainz_ro` makes no difference.
It is set to `musicbrainz_ro` as a precaution just in case the SSH
tunnel mistakenly points to a database other than the standby prod.

It relies on metabrainz/musicbrainz-server#1337
yvanzo added a commit to metabrainz/musicbrainz-docker that referenced this pull request Mar 24, 2020
This is a database definition for use by official maintainers only.

Note that standby/slave/secondary database is read-only anyway, thus
setting user to `musicbrainz` or musicbrainz_ro` makes no difference.
It is set to `musicbrainz_ro` as a precaution just in case the SSH
tunnel mistakenly points to a database other than the standby prod.

It relies on metabrainz/musicbrainz-server#1337
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants