-
Notifications
You must be signed in to change notification settings - Fork 7
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
Omnibus PR for our consideration 2019.10.04 #746
Conversation
update 3.6 to 3.7 in invocation to install pipenv
…oundError: No module named '_lzma' in pandas 0.25
…p staging.opencontext.org
…irst place -- new Django version?
…lf-signed wildcard ssl cert for opencontext as placeholder for certbot
@@ -20,3 +20,7 @@ | |||
*.PDF diff=astextplain | |||
*.rtf diff=astextplain | |||
*.RTF diff=astextplain | |||
|
|||
sysadmin/files/referral-spam.conf diff=ansible-vault merge=binary |
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.
I think it makes sense to encrypt open-context-py/referral-spam.conf at ry20191004 · rdhyee/open-context-py -- hence this line to help understand diffs in that file
@@ -0,0 +1,374 @@ | |||
$ANSIBLE_VAULT;1.2;AES256;oc |
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.
TO DO: extract out the sensitive stuff (like how we block certain requests) from the parts that would be very helpful to be plain text
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.
ok
@@ -0,0 +1,58 @@ | |||
[[source]] |
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.
General approach for setting up Pipfile is to set minimum versions but not fix any versions unless necessary.
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.
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.
OK!
@@ -0,0 +1,22 @@ | |||
import pytest |
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.
This file enables the use of production database for tests. One thing that needs to confirmed: is this the right place for this file?
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.
OK. I can look into this also. We should mainly just configure database access for tests that go in the tests/regression path. The "unit" tests should be completely database free, and the "integration" tests can use a short term database that gets temporarily set up and then torn down after the tests complete.
|
||
- name: Include vars of extra.yml | ||
include_vars: | ||
file: extra.yml |
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.
I will document how to use this in practice. e.g.,
oc_install_dir: /var/oc-venv
allowed_host: happy.opencontext.org
deployed_host: https://happy.opencontext.org
deployed_site_name: "happy OCserver"
server_name: happy.opencontext.org
git_user_name: "Raymond Yee"
git_user_email: "[email protected]"
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.
One thing that would be nice to work out: how to override variables that are in a dict like SECRET_KEYS
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.
OK
name: www-data | ||
state: present | ||
|
||
- name: add {{user}} to www-data group |
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.
We will need a way to add more people than just {{user}}
to the www-data
group
# exec "vagrant " + ARGV.join(' ') | ||
# end | ||
|
||
config.vm.define "opencontext" do |node| |
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.
So far, I've put in a lot of work on getting opencontext_predb
working (the configuration that relies on a pre-existing database and solr instance). But I'd like to make sure opencontext
configuration, which builds up a database and solr database from scratch also works.
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.
That sounds great!!
opencontext_py/tests/test_basic.py
Outdated
m_json_ld.request_full_path = '/projects-search/' | ||
m_json_ld.spatial_context = spatial_context | ||
json_ld = m_json_ld.convert_solr_json(response.raw_content) | ||
assert json_ld['totalResults'] == 2 |
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.
Change this to not test for a specific number of projects -- but to perhaps an inequality (e.g., >1).
|
||
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | ||
|
||
# required_plugins = %w( vagrant-vbguest vagrant-disksize ) |
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.
this commented out section is relevant to running Vagrant in conjunction with virtualbox, which has its own complications. I'll leave it commented out until one day there's a demand to get the virtualbox config working again.
@@ -0,0 +1,145 @@ | |||
{ |
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.
To do: document how this Jupyter notebook can be used to download static files.
"SOLR_COLLECTION": "{{SECRET_KEYS['SOLR_COLLECTION']}}", | ||
"STATIC_ROOT": "{{oc_install_dir}}/static", | ||
"GEOIP_PATH": "{{geoip_path}}", | ||
"FILE_CACHE_PATH": "{{oc_install_dir}}/cache/file-cache", |
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 enhancement: because there is more than one place where a file cache path is derived as "{{oc_install_dir}}/cache/file-cache"
, it might be helpful to compute that variable in one place (such as in the ansible playboo) and set to an ansible variable like file_cache_path
that then gets inserted in secrets.json.j2
client = Client() | ||
response = client.get(self.proj_context_uri, follow=True) | ||
assert response.status_code in [200,301] | ||
self.context_str = response.content | ||
self.data_str = self.load_json_file_str(self.data_file) |
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.
at this point, the setup still fails because self.data_str
is still None.
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.
do we need to check in dt-bone.json into the STATIC_IMPORTS_ROOT dir? Is there a complication to this?
…into staging_prod_ssl
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.
OK! I read through your comments and commented. I think this looks good, and we should start trying to work from this new framework. I'm going to need your help / support however transitioning and learning new workflows and "ops" stuff, but lets get this done and move on to search issues. Thanks for all your hard work Raymond! We're definitely on a much better dev-ops foundation now!
…ose from the opencontext_predb
# - name: Getting PYTHONPATH | ||
# local_action: shell python -c 'import sys; print(":".join(sys.path))' | ||
# register: pythonpath | ||
|
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.
for opencontext
, there are still steps left to build an instance with test data, which then get fed into a solr index. I might want to ansibilize those steps:
vagrant up opencontext --provider=google
After the machine comes up:
scp $(vagrant ssh-config opencontext | tail -n +2 | awk '{if ($1) print " -o "$1"="$2;}') ~/Downloads/feb-2019-oc-test.backup localhost:/tmp
Alternatively -- login to machine and
wget -P /tmp https://dl.dropboxusercontent.com/s/0gnydnhw4dpco6c/feb-2019-oc-test.backup
login to machine
vagrant ssh opencontext
cd /var/oc-venv
pipenv shell
Then:
python manage.py flush --noinput
Load the data:
PGPASSWORD=opencontextpw pg_restore -c -v -d opencontextdb -U opencontextuser -h localhost -Fc -j 8 /tmp/feb-2019-oc-test.backup
then to set up solr:
sudo -u solr bash -c "/opt/solr/bin/solr delete -c open-context"
sudo -u solr bash -c "/opt/solr/bin/solr create_core -c open-context"
sudo cp /var/oc-venv/solr-config/Solr-7/schema.xml /var/solr/data/open-context/conf/schema.xml
#sudo -u solr bash -c "cp /var/oc-venv/solr-config/Solr-7/solrconfig_201808.xml /var/solr/data/open-context/conf/solrconfig.xml"
sudo cp /var/oc-venv/solr-config/Solr-7/solrconfig.xml /var/solr/data/open-context/conf/solrconfig.xml
sudo cp /var/oc-venv/solr-config/Solr-7/currency.xml /var/solr/data/open-context/conf/currency.xml
sudo cp /var/oc-venv/solr-config/Solr-7/elevate.xml /var/solr/data/open-context/conf/elevate.xml
sudo cp /var/oc-venv/solr-config/Solr-7/email_url_types.txt /var/solr/data/open-context/conf/email_url_types.txt
sudo chown solr:solr /var/solr/data/open-context/conf/*
curl "http://localhost:8983/solr/admin/cores?action=RELOAD&core=open-context&&wt=json"
sudo -u solr bash -c "/opt/solr/bin/solr restart"
and then fire up the django shell ( python manage.py shell
)
from opencontext_py.apps.ocitems.manifest.models import Manifest
from opencontext_py.apps.indexer.reindex import SolrReIndex
uuids = [m.uuid for m in Manifest.objects.all()]
print('Items to index:{} '.format(len(uuids)))
sri = SolrReIndex()
sri.reindex_uuids(uuids)
# local_action: shell python -c 'import sys; print(":".join(sys.path))' | ||
# register: pythonpath | ||
|
||
# - debug: |
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.
Another thing that I've not built into build.yml is the series of database fixes (fixtures?) that might need to be run on old data. I've documented them at Some data fixes to apply to Open Context data
There is a lot of work about lots of different things represented here -- more than what ideally should be in one nice feature PR. Hence, this PR is meant as a vehicle for assessing the current status of my work and how to break things up for merging.
Some of the things covered in this PR (not an exhaustive list):
At this point, we're ready to try a staging server out in earnest to make sure there aren't any major problems -- and to understand whether the differences between the current production server and the ones created by vagrant/ansible are acceptable.
There are specific issues remaining to work out-- which will be detailed in the comments on this PR or separate issues.