Openverse is a search engine for openly-licensed media. This monorepo includes all application code.
Make general improvements to the Docker images, especially for analytics (#327)
Dhruv Bhanushalif8db92d85289
diff --git a/.github/workflows/integration_tests.yml b/.github/workflows/integration_tests.ymlindex c67163d8d..44bede6db 100644--- a/.github/workflows/integration_tests.yml+++ b/.github/workflows/integration_tests.yml@@ -63,7 +63,7 @@ jobs:uses: docker/build-push-action@v2with:context: ./ingestion_server/- file: ./ingestion_server/Dockerfile-worker+ file: ./ingestion_server/Dockerfile_workerpush: falseload: truetags: indexer_workerdiff --git a/analytics/Dockerfile b/analytics/Dockerfileindex 01b82e743..2c5a59902 100644--- a/analytics/Dockerfile+++ b/analytics/Dockerfile@@ -1,8 +1,6 @@FROM python:3.9ENV PYTHONBUFFERED 1-ENV PYTHONPATH .-WORKDIR /analytics# Install librdkafka, a dependency for confluent-kafkaRUN wget https://github.com/edenhill/librdkafka/archive/v1.6.1.tar.gz \@@ -11,14 +9,22 @@ RUN wget https://github.com/edenhill/librdkafka/archive/v1.6.1.tar.gz \&& ./configure \&& make && make install && ldconfig+ENV PYTHONPATH=$PYTHONPATH:/analytics++WORKDIR /analytics+# Install Python dependency management toolsRUN pip install --upgrade pip \&& pip install --upgrade setuptools \&& pip install --upgrade pipenv# Copy the Pipenv files into the container-COPY . /analytics/+COPY Pipfile Pipfile.lock /analytics/+# Install the dependencies system-wide+# TODO: Use build args to avoid installing dev dependencies in productionRUN pipenv install --deploy --system --dev+EXPOSE 8090-ENTRYPOINT pipenv run gunicorn -b '0.0.0.0:8090' server:api++CMD ["gunicorn"]diff --git a/analytics/Pipfile b/analytics/Pipfileindex 31a5d6112..ef66e8b00 100644--- a/analytics/Pipfile+++ b/analytics/Pipfile@@ -15,6 +15,7 @@ requests = "*"pytest = "*"falcon-cors = "*"confluent-kafka = "*"+python-decouple = "*"[requires]python_version = "3.9"diff --git a/analytics/Pipfile.lock b/analytics/Pipfile.lockindex d5f4a9fab..9e5bb49ed 100644--- a/analytics/Pipfile.lock+++ b/analytics/Pipfile.lock@@ -1,7 +1,7 @@{"_meta": {"hash": {- "sha256": "fe8281fd8a7de41f6456b3a2da4f31c917e83d709e6cccb1ac37411a67785e0e"+ "sha256": "292e28685713b74e42e78cceaea253cc9d0e20622e35a56b91e29c6ab2f2cbee"},"pipfile-spec": 6,"requires": {@@ -41,11 +41,11 @@},"charset-normalizer": {"hashes": [- "sha256:5d209c0a931f215cee683b6445e2d77677e7e75e159f78def0db09d68fafcaa6",- "sha256:5ec46d183433dcbd0ab716f2d7f29d8dee50505b3fdb40c6b985c7c4f5a3591f"+ "sha256:e019de665e2bcf9c2b64e2e5aa025fa991da8720daa3c1138cadd2fd1856aed0",+ "sha256:f7af805c321bfa1ce6714c51f254e0d5bb5e5834039bc17db7ebe3a4cec9492b"],"markers": "python_version >= '3'",- "version": "==2.0.6"+ "version": "==2.0.7"},"confluent-kafka": {"hashes": [@@ -179,11 +179,11 @@},"idna": {"hashes": [- "sha256:14475042e284991034cb48e06f6851428fb14c4dc953acd9be9a5e95c7b6dd7a",- "sha256:467fbad99067910785144ce333826c71fb0e63a425657295239737f7ecd125f3"+ "sha256:84d9dd047ffa80596e0f246e2eab0b391788b0503584e8945f2368256d2735ff",+ "sha256:9d643ff0a55b762d5cdb124b8eaa99c66322e2157b69160bc32796e824360e6d"],"markers": "python_version >= '3'",- "version": "==3.2"+ "version": "==3.3"},"iniconfig": {"hashes": [@@ -205,6 +205,7 @@"sha256:01a9b8ea66f1658938f65b93a85ebe8bc016e6769611be228d797c9d998dd298","sha256:023cb26ec21ece8dc3907c0e8320058b2e0cb3c55cf9564da612bc325bed5e64","sha256:0446679737af14f45767963a1a9ef7620189912317d095f2d9ffa183a4d25d2b",+ "sha256:04635854b943835a6ea959e948d19dcd311762c5c0c6e1f0e16ee57022669194","sha256:0717a7390a68be14b8c793ba258e075c6f4ca819f15edfc2a3a027c823718567","sha256:0955295dd5eec6cb6cc2fe1698f4c6d84af2e92de33fbcac4111913cd100a6ff","sha256:0d4b31cc67ab36e3392bbf3862cfbadac3db12bdd8b02a2731f509ed5b829724",@@ -212,6 +213,7 @@"sha256:168cd0a3642de83558a5153c8bd34f175a9a6e7f6dc6384b9655d2697312a646","sha256:1d609f577dc6e1aa17d746f8bd3c31aa4d258f4070d61b2aa5c4166c1539de35","sha256:1f2ade76b9903f39aa442b4aadd2177decb66525062db244b35d71d0ee8599b6",+ "sha256:20dca64a3ef2d6e4d5d615a3fd418ad3bde77a47ec8a23d984a12b5b4c74491a","sha256:2a7d351cbd8cfeb19ca00de495e224dea7e7d919659c2841bbb7f420ad03e2d6","sha256:2d7d807855b419fc2ed3e631034685db6079889a1f01d5d9dac950f764da3dad","sha256:2ef54abee730b502252bcdf31b10dacb0a416229b72c18b19e24a4509f273d26",@@ -219,27 +221,36 @@"sha256:37205cac2a79194e3750b0af2a5720d95f786a55ce7df90c3af697bfa100eaac","sha256:3c112550557578c26af18a1ccc9e090bfe03832ae994343cfdacd287db6a6ae7","sha256:3dd007d54ee88b46be476e293f48c85048603f5f516008bee124ddd891398ed6",+ "sha256:4296f2b1ce8c86a6aea78613c34bb1a672ea0e3de9c6ba08a960efe0b0a09047","sha256:47ab1e7b91c098ab893b828deafa1203de86d0bc6ab587b160f78fe6c4011f75","sha256:49e3ceeabbfb9d66c3aef5af3a60cc43b85c33df25ce03d0031a608b0a8b2e3f",+ "sha256:4dc8f9fb58f7364b63fd9f85013b780ef83c11857ae79f2feda41e270468dd9b","sha256:4efca8f86c54b22348a5467704e3fec767b2db12fc39c6d963168ab1d3fc9135","sha256:53edb4da6925ad13c07b6d26c2a852bd81e364f95301c66e930ab2aef5b5ddd8","sha256:5855f8438a7d1d458206a2466bf82b0f104a3724bf96a1c781ab731e4201731a","sha256:594c67807fb16238b30c44bdf74f36c02cdf22d1c8cda91ef8a0ed8dabf5620a",+ "sha256:5b6d930f030f8ed98e3e6c98ffa0652bdb82601e7a016ec2ab5d7ff23baa78d1","sha256:5bb28c636d87e840583ee3adeb78172efc47c8b26127267f54a9c0ec251d41a9","sha256:60bf42e36abfaf9aff1f50f52644b336d4f0a3fd6d8a60ca0d054ac9f713a864","sha256:611d1ad9a4288cf3e3c16014564df047fe08410e628f89805e475368bd304914",+ "sha256:6300b8454aa6930a24b9618fbb54b5a68135092bc666f7b06901f897fa5c2fee",+ "sha256:63f3268ba69ace99cab4e3e3b5840b03340efed0948ab8f78d2fd87ee5442a4f","sha256:6557b31b5e2c9ddf0de32a691f2312a32f77cd7681d8af66c2692efdbef84c18","sha256:693ce3f9e70a6cf7d2fb9e6c9d8b204b6b39897a2c4a1aa65728d5ac97dcc1d8","sha256:6a7fae0dd14cf60ad5ff42baa2e95727c3d81ded453457771d02b7d2b3f9c0c2","sha256:6c4ca60fa24e85fe25b912b01e62cb969d69a23a5d5867682dd3e80b5b02581d","sha256:6fcf051089389abe060c9cd7caa212c707e58153afa2c649f00346ce6d260f1b","sha256:7d91275b0245b1da4d4cfa07e0faedd5b0812efc15b702576d103293e252af1b",+ "sha256:89c687013cb1cd489a0f0ac24febe8c7a666e6e221b783e53ac50ebf68e45d86",+ "sha256:8d206346619592c6200148b01a2142798c989edcb9c896f9ac9722a99d4e77e6","sha256:905fec760bd2fa1388bb5b489ee8ee5f7291d692638ea5f67982d968366bef9f","sha256:97383d78eb34da7e1fa37dd273c20ad4320929af65d156e35a5e2d89566d9dfb","sha256:984d76483eb32f1bcb536dc27e4ad56bba4baa70be32fa87152832cdd9db0833","sha256:99df47edb6bda1249d3e80fdabb1dab8c08ef3975f69aed437cb69d0a5de1e28",+ "sha256:9f02365d4e99430a12647f09b6cc8bab61a6564363f313126f775eb4f6ef798e","sha256:a30e67a65b53ea0a5e62fe23682cfe22712e01f453b95233b25502f7c61cb415","sha256:ab3ef638ace319fa26553db0624c4699e31a28bb2a835c5faca8f8acf6a5a902",+ "sha256:aca6377c0cb8a8253e493c6b451565ac77e98c2951c45f913e0b52facdcff83f","sha256:add36cb2dbb8b736611303cd3bfcee00afd96471b09cda130da3581cbdc56a6d","sha256:b2f4bf27480f5e5e8ce285a8c8fd176c0b03e93dcc6646477d4630e83440c6a9","sha256:b7f2d075102dc8c794cbde1947378051c4e5180d52d276987b8d28a3bd58c17d",@@ -247,10 +258,14 @@"sha256:be98f628055368795d818ebf93da628541e10b75b41c559fdf36d104c5787066","sha256:bf5d821ffabf0ef3533c39c518f3357b171a1651c1ff6827325e4489b0e46c3c","sha256:c47adbc92fc1bb2b3274c4b3a43ae0e4573d9fbff4f54cd484555edbf030baf1",+ "sha256:cdfba22ea2f0029c9261a4bd07e830a8da012291fbe44dc794e488b6c9bb353a",+ "sha256:d6c7ebd4e944c85e2c3421e612a7057a2f48d478d79e61800d81468a8d842207","sha256:d7f9850398e85aba693bb640262d3611788b1f29a79f0c93c565694658f4071f","sha256:d8446c54dc28c01e5a2dbac5a25f071f6653e6e40f3a8818e8b45d790fe6ef53",+ "sha256:deb993cacb280823246a026e3b2d81c493c53de6acfd5e6bfe31ab3402bb37dd","sha256:e0f138900af21926a02425cf736db95be9f4af72ba1bb21453432a07f6082134","sha256:e9936f0b261d4df76ad22f8fee3ae83b60d7c3e871292cd42f40b81b70afae85",+ "sha256:f0567c4dc99f264f49fe27da5f735f414c4e7e7dd850cfd8e69f0862d7c74ea9","sha256:f5653a225f31e113b152e56f154ccbe59eeb1c7487b39b9d9f9cdb58e6c79dc5","sha256:f826e31d18b516f653fe296d967d700fddad5901ae07c622bb3705955e1faa94","sha256:f8ba0e8349a38d3001fae7eadded3f6606f0da5d748ee53cc1dab1d6527b9509",@@ -301,11 +316,11 @@},"pyparsing": {"hashes": [- "sha256:c203ec8783bf771a155b207279b9bccb8dea02d8f0c9e5f8ead507bc3246ecc1",- "sha256:ef9d7589ef3c200abe66653d3f1ab1033c3c419ae9b9bdb1240a85b024efc88b"+ "sha256:84196357aa3566d64ad123d7a3c67b0e597a115c4934b097580e5ce220b91531",+ "sha256:fd93fc45c47893c300bd98f5dd1b41c0e783eaeb727e7cea210dcc09d64ce7c3"],- "markers": "python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2, 3.3'",- "version": "==2.4.7"+ "markers": "python_version >= '3.6'",+ "version": "==3.0.1"},"pytest": {"hashes": [@@ -315,6 +330,14 @@"index": "pypi","version": "==6.2.5"},+ "python-decouple": {+ "hashes": [+ "sha256:011d3f785367c54a72cf8a07d3a7a48bb8cc1a0f8e6c70353ca5767ebf7c8c9d",+ "sha256:68e4b3fcc97e24bc90eecc514852d0bf970f4ff031f5f7a6728ddafa9afefcaf"+ ],+ "index": "pypi",+ "version": "==3.5"+ },"requests": {"hashes": ["sha256:6c1246513ecd5ecd4528a0906f910e8f0f9c6b8ec72030dc9fd154dc1a6efd24",@@ -325,39 +348,45 @@},"sqlalchemy": {"hashes": [- "sha256:0566a6e90951590c0307c75f9176597c88ef4be2724958ca1d28e8ae05ec8822",- "sha256:08d9396a2a38e672133266b31ed39b2b1f2b5ec712b5bff5e08033970563316a",- "sha256:0b08a53e40b34205acfeb5328b832f44437956d673a6c09fce55c66ab0e54916",- "sha256:16ef07e102d2d4f974ba9b0d4ac46345a411ad20ad988b3654d59ff08e553b1c",- "sha256:1adf3d25e2e33afbcd48cfad8076f9378793be43e7fec3e4334306cac6bec138",- "sha256:1b38db2417b9f7005d6ceba7ce2a526bf10e3f6f635c0f163e6ed6a42b5b62b2",- "sha256:1ebd69365717becaa1b618220a3df97f7c08aa68e759491de516d1c3667bba54",- "sha256:26b0cd2d5c7ea96d3230cb20acac3d89de3b593339c1447b4d64bfcf4eac1110",- "sha256:2ed67aae8cde4d32aacbdba4f7f38183d14443b714498eada5e5a7a37769c0b7",- "sha256:33a1e86abad782e90976de36150d910748b58e02cd7d35680d441f9a76806c18",- "sha256:41a916d815a3a23cb7fff8d11ad0c9b93369ac074e91e428075e088fe57d5358",- "sha256:6003771ea597346ab1e97f2f58405c6cacbf6a308af3d28a9201a643c0ac7bb3",- "sha256:6400b22e4e41cc27623a9a75630b7719579cd9a3a2027bcf16ad5aaa9a7806c0",- "sha256:6b602e3351f59f3999e9fb8b87e5b95cb2faab6a6ecdb482382ac6fdfbee5266",- "sha256:75cd5d48389a7635393ff5a9214b90695c06b3d74912109c3b00ce7392b69c6c",- "sha256:7ad59e2e16578b6c1a2873e4888134112365605b08a6067dd91e899e026efa1c",- "sha256:7b7778a205f956755e05721eebf9f11a6ac18b2409bff5db53ce5fe7ede79831",- "sha256:842c49dd584aedd75c2ee05f6c950730c3ffcddd21c5824ed0f820808387e1e3",- "sha256:90fe429285b171bcc252e21515703bdc2a4721008d1f13aa5b7150336f8a8493",- "sha256:91cd87d1de0111eaca11ccc3d31af441c753fa2bc22df72e5009cfb0a1af5b03",- "sha256:9a1df8c93a0dd9cef0839917f0c6c49f46c75810cf8852be49884da4a7de3c59",- "sha256:9ebe49c3960aa2219292ea2e5df6acdc425fc828f2f3d50b4cfae1692bcb5f02",- "sha256:a28fe28c359835f3be20c89efd517b35e8f97dbb2ca09c6cf0d9ac07f62d7ef6",- "sha256:a36ea43919e51b0de0c0bc52bcfdad7683f6ea9fb81b340cdabb9df0e045e0f7",- "sha256:a505ecc0642f52e7c65afb02cc6181377d833b7df0994ecde15943b18d0fa89c",- "sha256:a79abdb404d9256afb8aeaa0d3a4bc7d3b6d8b66103d8b0f2f91febd3909976e",- "sha256:c211e8ec81522ce87b0b39f0cf0712c998d4305a030459a0e115a2b3dc71598f",- "sha256:dd4ed12a775f2cde4519f4267d3601990a97d8ecde5c944ab06bfd6e8e8ea177",- "sha256:e37621b37c73b034997b5116678862f38ee70e5a054821c7b19d0e55df270dec",- "sha256:e93978993a2ad0af43f132be3ea8805f56b2f2cd223403ec28d3e7d5c6d39ed1"+ "sha256:07ac4461a1116b317519ddf6f34bcb00b011b5c1370ebeaaf56595504ffc7e84",+ "sha256:090536fd23bf49077ee94ff97142bc5ee8bad24294c3d7c8d5284267c885dde7",+ "sha256:1dee515578d04bc80c4f9a8c8cfe93f455db725059e885f1b1da174d91c4d077",+ "sha256:1ef37c9ec2015ce2f0dc1084514e197f2f199d3dc3514190db7620b78e6004c8",+ "sha256:295b90efef1278f27fe27d94a45460ae3c17f5c5c2b32c163e29c359740a1599",+ "sha256:2ce42ad1f59eb85c55c44fb505f8854081ee23748f76b62a7f569cfa9b6d0604",+ "sha256:2feb028dc75e13ba93456a42ac042b255bf94dbd692bf80b47b22653bb25ccf8",+ "sha256:31f4426cfad19b5a50d07153146b2bcb372a279975d5fa39f98883c0ef0f3313",+ "sha256:3c0c5f54560a92691d54b0768d67b4d3159e514b426cfcb1258af8c195577e8f",+ "sha256:463ef692259ff8189be42223e433542347ae17e33f91c1013e9c5c64e2798088",+ "sha256:4a882dedb9dfa6f33524953c3e3d72bcf518a5defd6d5863150a821928b19ad3",+ "sha256:4c185c928e2638af9bae13acc3f70e0096eac76471a1101a10f96b80666b8270",+ "sha256:5039faa365e7522a8eb4736a54afd24a7e75dcc33b81ab2f0e6c456140f1ad64",+ "sha256:5c6774b34782116ad9bdec61c2dbce9faaca4b166a0bc8e7b03c2b870b121d94",+ "sha256:6bc7f9d7d90ef55e8c6db1308a8619cd8f40e24a34f759119b95e7284dca351a",+ "sha256:7e8ef103eaa72a857746fd57dda5b8b5961e8e82a528a3f8b7e2884d8506f0b7",+ "sha256:7ef421c3887b39c6f352e5022a53ac18de8387de331130481cb956b2d029cad6",+ "sha256:908fad32c53b17aad12d722379150c3c5317c422437e44032256a77df1746292",+ "sha256:91efbda4e6d311812f23996242bad7665c1392209554f8a31ec6db757456db5c",+ "sha256:a6506c17b0b6016656783232d0bdd03fd333f1f654d51a14d93223f953903646",+ "sha256:a95bf9c725012dcd7ea3cac16bf647054e0d62b31d67467d228338e6a163e4ff",+ "sha256:ad7e403fc1e3cb76e802872694e30d6ca6129b9bc6ad4e7caa48ca35f8a144f8",+ "sha256:b86f762cee3709722ab4691981958cbec475ea43406a6916a7ec375db9cbd9e9",+ "sha256:ba84026e84379326bbf2f0c50792f2ae56ab9c01937df5597b6893810b8ca369",+ "sha256:bca660b76672e15d70a7dba5e703e1ce451a0257b6bd2028e62b0487885e8ae9",+ "sha256:c24c01dcd03426a5fe5ee7af735906bec6084977b9027a3605d11d949a565c01",+ "sha256:c2f2114b0968a280f94deeeaa31cfbac9175e6ac7bd3058b3ce6e054ecd762b3",+ "sha256:c46f013ff31b80cbe36410281675e1fb4eaf3e25c284fd8a69981c73f6fa4cb4",+ "sha256:c757ba1279b85b3460e72e8b92239dae6f8b060a75fb24b3d9be984dd78cfa55",+ "sha256:cc6b21f19bc9d4cd77cbcba5f3b260436ce033f1053cea225b6efea2603d201e",+ "sha256:dbf588ab09e522ac2cbd010919a592c6aae2f15ccc3cd9a96d01c42fbc13f63e",+ "sha256:de996756d894a2d52c132742e3b6d64ecd37e0919ddadf4dc3981818777c7e67",+ "sha256:e700d48056475d077f867e6a36e58546de71bdb6fdc3d34b879e3240827fefab",+ "sha256:f1e97c5f36b94542f72917b62f3a2f92be914b2cf33b80fa69cede7529241d2a",+ "sha256:fb2aa74a6e3c2cebea38dd21633671841fbe70ea486053cba33d68e3e22ccc0a",+ "sha256:ff8f91a7b1c4a1c7772caa9efe640f2768828897044748f2458b708f1026e2d4"],"index": "pypi",- "version": "==1.4.25"+ "version": "==1.4.26"},"toml": {"hashes": [diff --git a/analytics/docs/redoc.html b/analytics/docs/redoc.htmlindex c75c4cd0e..94ffef81e 100644--- a/analytics/docs/redoc.html+++ b/analytics/docs/redoc.html@@ -1,11 +1,10 @@<!DOCTYPE html><html><head>- <title>ReDoc</title>+ <title>Openverse Analytics</title><!-- needed for adaptive design --><meta charset="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1">- <link href="https://fonts.googleapis.com/css?family=Montserrat:300,400,700|Roboto:300,400,700" rel="stylesheet"><!--ReDoc doesn't change outer page styles@@ -15,10 +14,14 @@margin: 0;padding: 0;}++ img[alt='logo'] {+ padding: 20px; /* same as other sidebar items */+ }</style></head><body>- <redoc spec-url='https://api.openverse.engineering/analytics/swagger.yaml'></redoc>- <script src="https://cdn.jsdelivr.net/npm/redoc@next/bundles/redoc.standalone.js"> </script>+ <redoc spec-url='/swagger.yaml' expand-responses="all"></redoc>+ <script src="https://cdn.jsdelivr.net/npm/redoc/bundles/redoc.standalone.js"> </script></body></html>diff --git a/analytics/docs/swagger.yaml b/analytics/docs/swagger.yamlindex d63656830..ddfdd8e96 100644--- a/analytics/docs/swagger.yaml+++ b/analytics/docs/swagger.yaml@@ -1,16 +1,26 @@swagger: "2.0"+info:- description: "An API for registering anonymous usage data events in Openverse, which we intend to use to improve the quality of the search results."+ description: |+ # Introduction++ An API for registering anonymous usage data events in Openverse, which we+ intend to use to improve the quality of the search results.version: "1.0.0"- title: "Openverse Usage Data API"+ title: "Openverse Analytics"termsOfService: "https://api.openverse.engineering/terms_of_service.html"contact:- email: "[email protected]"+ email: "[email protected]"license:name: "MIT License"- url: "https://github.com/wordpress/openverse-api/blob/master/LICENSE"+ url: "https://github.com/WordPress/openverse-api/blob/HEAD/LICENSE"+ x-logo:+ url: "https://raw.githubusercontent.com/WordPress/openverse/HEAD/brand/logo.svg"+ backgroundColor: "#fafafa"+host: "api.openverse.engineering"basePath: "/analytics"+tags:- name: "Register events"description: "Send events to the analytics server."@@ -184,5 +194,5 @@ definitions:description: "The unique identifier for the detail page associated with the event."externalDocs:- description: "The Openverse API"+ description: "Openverse API docs"url: "https://api.openverse.engineering"diff --git a/analytics/env.docker b/analytics/env.dockernew file mode 100644index 000000000..29baf81fd--- /dev/null+++ b/analytics/env.docker@@ -0,0 +1 @@+DATABASE_CONN="postgresql+psycopg2://deploy:deploy@db/openledger"diff --git a/analytics/env.template b/analytics/env.templatenew file mode 100644index 000000000..286fe2629--- /dev/null+++ b/analytics/env.template@@ -0,0 +1 @@+#DATABASE_CONN="postgresql+psycopg2://deploy:deploy@localhost/openledger"diff --git a/analytics/gunicorn.conf.py b/analytics/gunicorn.conf.pynew file mode 100644index 000000000..c2c23703d--- /dev/null+++ b/analytics/gunicorn.conf.py@@ -0,0 +1,2 @@+bind = ["0.0.0.0:8090"]+wsgi_app = "server:api"diff --git a/analytics/settings.py b/analytics/settings.pyindex 40608bb4b..3ac79ee81 100644--- a/analytics/settings.py+++ b/analytics/settings.py@@ -1,11 +1,12 @@-import os+from decouple import config-DATABASE_CONNECTION = os.getenv(- "DATABASE_CONN", "postgresql+psycopg2://deploy:deploy@localhost/openledger"+DATABASE_CONNECTION = config(+ "DATABASE_CONN",+ default="postgresql+psycopg2://deploy:deploy@localhost/openledger",)# Attribution events stream configuration-KAFKA_HOSTS = os.getenv("KAFKA_HOSTS", "kafka:9092")-KAFKA_TOPIC_NAME = os.getenv("KAFKA_TOPIC", "attribution_events_dev")-ATTRIBUTION_LOGFILE = os.getenv("LOGFILE", "/var/log/attribution_worker.log")+KAFKA_HOSTS = config("KAFKA_HOSTS", default="kafka:9092")+KAFKA_TOPIC_NAME = config("KAFKA_TOPIC", default="attribution_events_dev")+ATTRIBUTION_LOGFILE = config("LOGFILE", default="/var/log/attribution_worker.log")diff --git a/analytics/tests.py b/analytics/tests.pyindex e78d650d8..0d302900c 100644--- a/analytics/tests.py+++ b/analytics/tests.py@@ -1,3 +1,8 @@+"""+End-to-end tests of the analytics server. These tests are written to work with+``pytest``.+"""+import datetimeimport jsonimport os@@ -18,11 +23,6 @@ from analytics.report_controller import ()-"""-End-to-end tests of the analytics server. Run with `pytest -s`.-"""--API_URL = os.getenv("ANALYTICS_SERVER_URL", "http://localhost:8090")session_id = "00000000-0000-0000-0000-000000000000"result_id = "29cb352c-60c1-41d8-bfa1-7d6f7d955f63"diff --git a/docker-compose.yml b/docker-compose.ymlindex ae887cff6..f5e87dee8 100644--- a/docker-compose.yml+++ b/docker-compose.yml@@ -26,6 +26,11 @@ services:healthcheck:test: "pg_isready -U deploy -d openledger"+ cache:+ image: redis:4.0.10+ ports:+ - "6379:6379"+es:image: docker.elastic.co/elasticsearch/elasticsearch:7.12.0ports:@@ -50,14 +55,12 @@ services:mem_limit: ${ES_MEM_LIMIT:-4294967296} # 4 GiB in bytesweb:- build: openverse_api/+ build: ./openverse_api/image: openverse_api- command: python manage.py runserver 0.0.0.0:8000volumes:- ./openverse_api:/openverse_apiports:- "8000:8000"- - "4444:4444"depends_on:- db- es@@ -67,11 +70,6 @@ services:stdin_open: truetty: true- cache:- image: redis:4.0.10- ports:- - "6379:6379"-ingestion-server:build: ./ingestion_server/image: ingestion_server@@ -92,7 +90,7 @@ services:indexer-worker:build:context: ./ingestion_server/- dockerfile: Dockerfile-worker+ dockerfile: Dockerfile_workerimage: indexer_workerports:- "8002:8002"@@ -111,5 +109,7 @@ services:image: analyticsports:- "8090:8090"- environment:- DATABASE_CONN: "postgresql+psycopg2://deploy:deploy@db/openledger"+ volumes:+ - ./analytics:/analytics+ env_file:+ - ./analytics/env.dockerdiff --git a/ingestion_server/Dockerfile b/ingestion_server/Dockerfileindex 41700c43d..ed5746236 100644--- a/ingestion_server/Dockerfile+++ b/ingestion_server/Dockerfile@@ -9,7 +9,6 @@ RUN apt-get update \&& apt-get install -y supervisor \&& mkdir -p /var/log/supervisord/ \&& chown -R supervisord:supervisord /var/log/supervisord \- && mkdir /ingestion_server \&& mkdir /worker_state \&& chown -R supervisord:supervisord /worker_state@@ -23,14 +22,14 @@ RUN pip install --upgrade pip \&& pip install --upgrade pipenv# Copy the Pipenv files into the container-COPY Pipfile /ingestion_server/-COPY Pipfile.lock /ingestion_server/+COPY Pipfile Pipfile.lock /ingestion_server/# Install the dependencies system-wide# TODO: Use build args to avoid installing dev dependencies in productionRUN pipenv install --deploy --system --devUSER supervisord+EXPOSE 8001CMD ["supervisord", "-c", "/ingestion_server/config/supervisord.conf"]diff --git a/ingestion_server/Dockerfile-worker b/ingestion_server/Dockerfile_workersimilarity index 65%rename from ingestion_server/Dockerfile-workerrename to ingestion_server/Dockerfile_workerindex e0b3ae1ed..5ba2599c4 100644--- a/ingestion_server/Dockerfile-worker+++ b/ingestion_server/Dockerfile_worker@@ -2,8 +2,7 @@ FROM python:3.9ENV PYTHONBUFFERED 1-RUN mkdir /ingestion_server \- && mkdir /worker_state+RUN mkdir /worker_stateENV PYTHONPATH=$PYTHONPATH:/ingestion_server/@@ -15,8 +14,7 @@ RUN pip install --upgrade pip \&& pip install --upgrade pipenv# Copy the Pipenv files into the container-COPY Pipfile /ingestion_server/-COPY Pipfile.lock /ingestion_server/+COPY Pipfile Pipfile.lock /ingestion_server/# Install the dependencies system-wide# TODO: Use build args to avoid installing dev dependencies in production@@ -24,4 +22,4 @@ RUN pipenv install --deploy --system --devEXPOSE 8002-CMD gunicorn indexer_worker:api -b 0.0.0.0:8002 --reload --access-logfile '-' --error-logfile '-' --chdir ./ingestion_server/+CMD ["gunicorn", "-c", "./gunicorn_worker.conf.py"]diff --git a/ingestion_server/gunicorn_worker.conf.py b/ingestion_server/gunicorn_worker.conf.pynew file mode 100644index 000000000..df032c58e--- /dev/null+++ b/ingestion_server/gunicorn_worker.conf.py@@ -0,0 +1,9 @@+bind = ["0.0.0.0:8002"]+capture_output = True+chdir = "./ingestion_server/"+timeout = 120+reload = True+loglevel = "debug"+wsgi_app = "indexer_worker:api"+accesslog = "-"+errorlog = "-"diff --git a/justfile b/justfileindex a32364cda..9d1913e6d 100644--- a/justfile+++ b/justfile@@ -48,6 +48,7 @@ logs services="":env:cp openverse_api/env.template openverse_api/.envcp ingestion_server/env.template ingestion_server/.env+ cp analytics/env.template analytics/.env# Load sample data into the Docker Compose servicesinit: wait-for-es wait-for-is wait-for-webdiff --git a/openverse_api/Dockerfile b/openverse_api/Dockerfileindex 6280bf92f..7e6125419 100644--- a/openverse_api/Dockerfile+++ b/openverse_api/Dockerfile@@ -10,7 +10,6 @@ ENV PYTHONBUFFERED 1RUN apt-get update \&& apt-get install -y libexempi8 \&& rm -rf /var/lib/apt/lists/* \- && mkdir /openverse_api \&& mkdir -p /var/log/openverse_api/openverse_api.logADD catalog/api/utils/fonts/SourceSansPro-Bold.ttf /usr/share/fonts/truetype/SourceSansPro-Bold.ttf@@ -23,8 +22,7 @@ RUN pip install --upgrade pip \&& pip install --upgrade pipenv# Copy the Pipenv files into the container-COPY Pipfile /openverse_api/-COPY Pipfile.lock /openverse_api/+COPY Pipfile Pipfile.lock /openverse_api/# Install the dependencies system-wide# TODO: Use build args to avoid installing dev dependencies in production@@ -33,4 +31,8 @@ RUN pipenv install --deploy --system --devCOPY --from=awf /deps /COPY --from=awf /usr/local/bin/audiowaveform /usr/local/bin+EXPOSE 8000+ENTRYPOINT ["./run.sh"]++CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"]diff --git a/openverse_api/catalog/urls/swagger.py b/openverse_api/catalog/urls/swagger.pyindex 874f87db8..2935c4e85 100644--- a/openverse_api/catalog/urls/swagger.py+++ b/openverse_api/catalog/urls/swagger.py@@ -15,10 +15,8 @@ with open(description_path, "r") as description_file:description = description_file.read()tos_url = "https://api.openverse.engineering/terms_of_service.html"-license_url = "https://github.com/" "WordPress/openverse-api/blob/master/LICENSE"-logo_url = (- "https://raw.githubusercontent.com/" "WordPress/openverse/master/brand/logo.svg"-)+license_url = "https://github.com/WordPress/openverse-api/blob/HEAD/LICENSE"+logo_url = "https://raw.githubusercontent.com/WordPress/openverse/HEAD/brand/logo.svg"schema_view = get_schema_view(openapi.Info(title="Openverse API",