-
Notifications
You must be signed in to change notification settings - Fork 687
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
Migrate to static config #3850
Migrate to static config #3850
Conversation
02de5cd
to
4424c2c
Compare
For the 11/28-12/12 sprint, we will aim to do a first time-boxed review; not planning to merge yet. |
I was planning to make the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did a first pass review this afternoon, some comments/thoughts inline!
install_files/ansible-base/roles/app/tasks/initialize_securedrop_app.yml
Outdated
Show resolved
Hide resolved
sd_custom_logo = os.path.join(sd_code, "static/i/logo.png") | ||
|
||
tor_hidden_services = "/var/lib/tor/services" | ||
torrc = "/etc/tor/torrc" | ||
|
||
with tarfile.open(backup_filename, 'w:gz') as backup: | ||
backup.add(sd_config_py) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possible edge case here:
- User backs up SecureDrop on 0.11.0 which uses
config.py
- User restores to new SecureDrop 0.12.0 install which uses
config.json
The migration won't occur in this case, no? Running migrate_config.py
as part of the restore logic should resolve.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see the logic in restore.py
to see if this does the trick.
install_files/ansible-base/roles/app/tasks/initialize_securedrop_app.yml
Outdated
Show resolved
Hide resolved
Before this is merged, an open question is: should |
install_files/ansible-base/roles/app/tasks/initialize_securedrop_app.yml
Outdated
Show resolved
Hide resolved
c81876a
to
a808d41
Compare
As we discussed last night, please go ahead and split them across into two files. This PR also needs |
a808d41
to
77c2d42
Compare
@kushaldas @redshiftzero I've made a few more changes. Basically all all the config generation logic has been moved into |
Ah, also the configs were split into a source and journalist version, both as python classes and different JSON files. I also stripped out all global references to the config and everything is injected (for tests and the application). |
Codecov Report
@@ Coverage Diff @@
## develop #3850 +/- ##
===========================================
+ Coverage 84.67% 84.85% +0.17%
===========================================
Files 43 44 +1
Lines 2760 2918 +158
Branches 299 318 +19
===========================================
+ Hits 2337 2476 +139
- Misses 355 364 +9
- Partials 68 78 +10
Continue to review full report at Codecov.
|
molecule/testinfra/staging/app-code/test_securedrop_app_code.py
Outdated
Show resolved
Hide resolved
securedrop/sdconfig.py
Outdated
self.DATABASE_USERNAME = _config.DATABASE_USERNAME # type: ignore | ||
except AttributeError: | ||
pass | ||
self.SECUREDROP_DATA_ROOT = '/var/lib/securedrop/' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add the type annotations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you check again that sufficient type annotations have been added?
ad683b3
to
dc1c9ca
Compare
Recapping our discussion from sprint planning today: We want to minimize the risks associated with this big (and important!) change by ensuring we express through automated tests the potential states that the configuration file can be in. The number of states should be manageable given that the file is not manually edited: when have the playbooks been run, and what features have been explicitly enabled? We must assume that there are long-running instances that have not run playbooks since pre-0.4. @heartsucker -- on the FPF side, we've committed to up to 8 person hours to help get this closer to the finish line, but we should make sure we're on the same page vis-a-vis the testing strategy. Let's discuss w/ @redshiftzero on Gitter, or during standup, next time you're around. |
As a note to reviewers, the test |
79db0b0
to
3c5d2e2
Compare
we don't want the backup script to error out if config files are missing since we don't know the exact combination that will be present on a prod server
7ff03ad
to
0ee5747
Compare
Hi @heartsucker, this has been sitting for a long time and I think it's time to acknowledge that we're probably not going to land a version of this change, which would require significant PR surgery at this point, and which is quite high-risk in terms of potential for breaking existing configs. Instead our bias is to prioritize moving as many settings as reasonably possible to the database (where we can use alembic migrations for change management) and to expose them via the web-based admin UI. I'm going to leave this open a few more days in case other folks want to make the case for revisiting this PR, and then close if there are no objections. |
Closing PR per the above comment; let's keep the |
Status
Ready for review
Description of Changes
Fixes #1966
Changes proposed in this pull request:
config.json
configuration file and fieldsconfig.py
into newconfig.json
ansible
Testing
New Installs
dpkg -i
the app code deb (or just runpostinst
)Old Installs (with ansible)
develop
that this branchconfig.py
/tmp
or~
dpkg -i
the app code deb (or just runpostinst
)Old Installs (without ansible)
develop
that this branchscp
to VMcron-apt
)config.py
/tmp
or~
dpkg -i
the app code deb (or just runpostinst
)Old Installs Backup/Restore
develop
that this branchrm /etc/securedrop/*.json
config.py
Deployment
We need to be able to support the following cases:
config.py
is not presentconfig.py
present,config.py
has partial configurationconfig.json
present,config.json
has partial configurationChecklist
If you made changes to the server application code:
make ci-lint
) and tests (make -C securedrop test
) pass in the development containerIf you made changes to the system configuration:
If you made non-trivial code changes: