Merge branch 'release/0.3.0' into production

This commit is contained in:
Jan Dittberner 2020-04-05 23:40:08 +02:00
commit 6211a9d88e
30 changed files with 592 additions and 205 deletions

1
.gitignore vendored
View file

@ -43,3 +43,4 @@ _build/
*.sqlite3 *.sqlite3
.idea/ .idea/
.vagrant/ .vagrant/
.env

51
Dockerfile Normal file
View file

@ -0,0 +1,51 @@
ARG DEBIAN_RELEASE=buster
FROM debian:$DEBIAN_RELEASE
LABEL maintainer="Jan Dittberner <jan@dittberner.info>"
ENV LC_ALL=C.UTF-8
ENV LANG=C.UTF-8
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
build-essential \
dumb-init \
gettext \
git \
python3-dev \
python3-pip \
python3-setuptools \
python3-virtualenv \
python3-wheel \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*.*
RUN python3 -m pip install --prefix=/usr/local pipenv
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
libpq-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*.*
ARG GVAGID=2000
ARG GVAUID=2000
ARG GVAAPP=gvapgsql
WORKDIR /srv/$GVAAPP
COPY Pipfile Pipfile.lock /srv/$GVAAPP/
RUN addgroup --gid $GVAGID $GVAAPP ; \
adduser --home /home/$GVAAPP --shell /bin/bash --uid $GVAUID --gid $GVAGID --disabled-password --gecos "User for gnuviechadmin component $GVAAPP" $GVAAPP
USER $GVAAPP
RUN python3 -m virtualenv --python=python3 /home/$GVAAPP/$GVAAPP-venv ; \
/home/$GVAAPP/$GVAAPP-venv/bin/python3 -m pip install -U pip ; \
VIRTUAL_ENV=/home/$GVAAPP/$GVAAPP-venv pipenv install --deploy --ignore-pipfile --dev
VOLUME /srv/$GVAAPP
COPY gvapgsql.sh /srv/
ENTRYPOINT ["dumb-init", "/srv/gvapgsql.sh"]

21
Pipfile Normal file
View file

@ -0,0 +1,21 @@
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true
[dev-packages]
coverage = "*"
releases = "*"
Sphinx = "*"
[packages]
amqp = "*"
anyjson = "*"
celery = "*"
kombu = "*"
psycopg2 = "*"
pytz = "*"
redis = "*"
[requires]
python_version = "3.7"

370
Pipfile.lock generated Normal file
View file

@ -0,0 +1,370 @@
{
"_meta": {
"hash": {
"sha256": "ffd1ab4d63cbf1f806807e7faca8fe94a73f23107f88cc5624ac4a94dd452eb1"
},
"pipfile-spec": 6,
"requires": {
"python_version": "3.7"
},
"sources": [
{
"name": "pypi",
"url": "https://pypi.org/simple",
"verify_ssl": true
}
]
},
"default": {
"amqp": {
"hashes": [
"sha256:6e649ca13a7df3faacdc8bbb280aa9a6602d22fd9d545336077e573a1f4ff3b8",
"sha256:77f1aef9410698d20eaeac5b73a87817365f457a507d82edf292e12cbb83b08d"
],
"index": "pypi",
"version": "==2.5.2"
},
"anyjson": {
"hashes": [
"sha256:37812d863c9ad3e35c0734c42e0bf0320ce8c3bed82cd20ad54cb34d158157ba"
],
"index": "pypi",
"version": "==0.3.3"
},
"billiard": {
"hashes": [
"sha256:bff575450859a6e0fbc2f9877d9b715b0bbc07c3565bb7ed2280526a0cdf5ede",
"sha256:d91725ce6425f33a97dfa72fb6bfef0e47d4652acd98a032bd1a7fbf06d5fa6a"
],
"version": "==3.6.3.0"
},
"celery": {
"hashes": [
"sha256:3c5fcd6bfcf9a6323cb742cfc121d1790d50cfeddf300ba723cfa0b356413f07",
"sha256:a650525303ee866fb0c62c82f68681fcc2183eebbfafae552c27d30125fe518b"
],
"index": "pypi",
"version": "==4.4.1"
},
"importlib-metadata": {
"hashes": [
"sha256:06f5b3a99029c7134207dd882428a66992a9de2bef7c2b699b5641f9886c3302",
"sha256:b97607a1a18a5100839aec1dc26a1ea17ee0d93b20b0f008d80a5a050afb200b"
],
"markers": "python_version < '3.8'",
"version": "==1.5.0"
},
"kombu": {
"hashes": [
"sha256:2d1cda774126a044d91a7ff5fa6d09edf99f46924ab332a810760fe6740e9b76",
"sha256:598e7e749d6ab54f646b74b2d2df67755dee13894f73ab02a2a9feb8870c7cb2"
],
"index": "pypi",
"version": "==4.6.8"
},
"psycopg2": {
"hashes": [
"sha256:4212ca404c4445dc5746c0d68db27d2cbfb87b523fe233dc84ecd24062e35677",
"sha256:47fc642bf6f427805daf52d6e52619fe0637648fe27017062d898f3bf891419d",
"sha256:72772181d9bad1fa349792a1e7384dde56742c14af2b9986013eb94a240f005b",
"sha256:8396be6e5ff844282d4d49b81631772f80dabae5658d432202faf101f5283b7c",
"sha256:893c11064b347b24ecdd277a094413e1954f8a4e8cdaf7ffbe7ca3db87c103f0",
"sha256:92a07dfd4d7c325dd177548c4134052d4842222833576c8391aab6f74038fc3f",
"sha256:965c4c93e33e6984d8031f74e51227bd755376a9df6993774fd5b6fb3288b1f4",
"sha256:9ab75e0b2820880ae24b7136c4d230383e07db014456a476d096591172569c38",
"sha256:b0845e3bdd4aa18dc2f9b6fb78fbd3d9d371ad167fd6d1b7ad01c0a6cdad4fc6",
"sha256:dca2d7203f0dfce8ea4b3efd668f8ea65cd2b35112638e488a4c12594015f67b",
"sha256:ed686e5926929887e2c7ae0a700e32c6129abb798b4ad2b846e933de21508151",
"sha256:ef6df7e14698e79c59c7ee7cf94cd62e5b869db369ed4b1b8f7b729ea825712a",
"sha256:f898e5cc0a662a9e12bde6f931263a1bbd350cfb18e1d5336a12927851825bb6"
],
"index": "pypi",
"version": "==2.8.4"
},
"pytz": {
"hashes": [
"sha256:1c557d7d0e871de1f5ccd5833f60fb2550652da6be2693c1e02300743d21500d",
"sha256:b02c06db6cf09c12dd25137e563b31700d3b80fcc4ad23abb7a315f2789819be"
],
"index": "pypi",
"version": "==2019.3"
},
"redis": {
"hashes": [
"sha256:0dcfb335921b88a850d461dc255ff4708294943322bd55de6cfd68972490ca1f",
"sha256:b205cffd05ebfd0a468db74f0eedbff8df1a7bfc47521516ade4692991bb0833"
],
"index": "pypi",
"version": "==3.4.1"
},
"vine": {
"hashes": [
"sha256:133ee6d7a9016f177ddeaf191c1f58421a1dcc6ee9a42c58b34bed40e1d2cd87",
"sha256:ea4947cc56d1fd6f2095c8d543ee25dad966f78692528e68b4fada11ba3f98af"
],
"version": "==1.3.0"
},
"zipp": {
"hashes": [
"sha256:aa36550ff0c0b7ef7fa639055d797116ee891440eac1a56f378e2d3179e0320b",
"sha256:c599e4d75c98f6798c509911d08a22e6c021d074469042177c8c86fb92eefd96"
],
"version": "==3.1.0"
}
},
"develop": {
"alabaster": {
"hashes": [
"sha256:446438bdcca0e05bd45ea2de1668c1d9b032e1a9154c2c259092d77031ddd359",
"sha256:a661d72d58e6ea8a57f7a86e37d86716863ee5e92788398526d58b26a4e4dc02"
],
"version": "==0.7.12"
},
"babel": {
"hashes": [
"sha256:1aac2ae2d0d8ea368fa90906567f5c08463d98ade155c0c4bfedd6a0f7160e38",
"sha256:d670ea0b10f8b723672d3a6abeb87b565b244da220d76b4dba1b66269ec152d4"
],
"version": "==2.8.0"
},
"certifi": {
"hashes": [
"sha256:017c25db2a153ce562900032d5bc68e9f191e44e9a0f762f373977de9df1fbb3",
"sha256:25b64c7da4cd7479594d035c08c2d809eb4aab3a26e5a990ea98cc450c320f1f"
],
"version": "==2019.11.28"
},
"chardet": {
"hashes": [
"sha256:84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae",
"sha256:fc323ffcaeaed0e0a02bf4d117757b98aed530d9ed4531e3e15460124c106691"
],
"version": "==3.0.4"
},
"coverage": {
"hashes": [
"sha256:15cf13a6896048d6d947bf7d222f36e4809ab926894beb748fc9caa14605d9c3",
"sha256:1daa3eceed220f9fdb80d5ff950dd95112cd27f70d004c7918ca6dfc6c47054c",
"sha256:1e44a022500d944d42f94df76727ba3fc0a5c0b672c358b61067abb88caee7a0",
"sha256:25dbf1110d70bab68a74b4b9d74f30e99b177cde3388e07cc7272f2168bd1477",
"sha256:3230d1003eec018ad4a472d254991e34241e0bbd513e97a29727c7c2f637bd2a",
"sha256:3dbb72eaeea5763676a1a1efd9b427a048c97c39ed92e13336e726117d0b72bf",
"sha256:5012d3b8d5a500834783689a5d2292fe06ec75dc86ee1ccdad04b6f5bf231691",
"sha256:51bc7710b13a2ae0c726f69756cf7ffd4362f4ac36546e243136187cfcc8aa73",
"sha256:527b4f316e6bf7755082a783726da20671a0cc388b786a64417780b90565b987",
"sha256:722e4557c8039aad9592c6a4213db75da08c2cd9945320220634f637251c3894",
"sha256:76e2057e8ffba5472fd28a3a010431fd9e928885ff480cb278877c6e9943cc2e",
"sha256:77afca04240c40450c331fa796b3eab6f1e15c5ecf8bf2b8bee9706cd5452fef",
"sha256:7afad9835e7a651d3551eab18cbc0fdb888f0a6136169fbef0662d9cdc9987cf",
"sha256:9bea19ac2f08672636350f203db89382121c9c2ade85d945953ef3c8cf9d2a68",
"sha256:a8b8ac7876bc3598e43e2603f772d2353d9931709345ad6c1149009fd1bc81b8",
"sha256:b0840b45187699affd4c6588286d429cd79a99d509fe3de0f209594669bb0954",
"sha256:b26aaf69713e5674efbde4d728fb7124e429c9466aeaf5f4a7e9e699b12c9fe2",
"sha256:b63dd43f455ba878e5e9f80ba4f748c0a2156dde6e0e6e690310e24d6e8caf40",
"sha256:be18f4ae5a9e46edae3f329de2191747966a34a3d93046dbdf897319923923bc",
"sha256:c312e57847db2526bc92b9bfa78266bfbaabac3fdcd751df4d062cd4c23e46dc",
"sha256:c60097190fe9dc2b329a0eb03393e2e0829156a589bd732e70794c0dd804258e",
"sha256:c62a2143e1313944bf4a5ab34fd3b4be15367a02e9478b0ce800cb510e3bbb9d",
"sha256:cc1109f54a14d940b8512ee9f1c3975c181bbb200306c6d8b87d93376538782f",
"sha256:cd60f507c125ac0ad83f05803063bed27e50fa903b9c2cfee3f8a6867ca600fc",
"sha256:d513cc3db248e566e07a0da99c230aca3556d9b09ed02f420664e2da97eac301",
"sha256:d649dc0bcace6fcdb446ae02b98798a856593b19b637c1b9af8edadf2b150bea",
"sha256:d7008a6796095a79544f4da1ee49418901961c97ca9e9d44904205ff7d6aa8cb",
"sha256:da93027835164b8223e8e5af2cf902a4c80ed93cb0909417234f4a9df3bcd9af",
"sha256:e69215621707119c6baf99bda014a45b999d37602cb7043d943c76a59b05bf52",
"sha256:ea9525e0fef2de9208250d6c5aeeee0138921057cd67fcef90fbed49c4d62d37",
"sha256:fca1669d464f0c9831fd10be2eef6b86f5ebd76c724d1e0706ebdff86bb4adf0"
],
"index": "pypi",
"version": "==5.0.3"
},
"docutils": {
"hashes": [
"sha256:0c5b78adfbf7762415433f5515cd5c9e762339e23369dbe8000d84a4bf4ab3af",
"sha256:c2de3a60e9e7d07be26b7f2b00ca0309c207e06c100f9cc2a94931fc75a478fc"
],
"version": "==0.16"
},
"idna": {
"hashes": [
"sha256:7588d1c14ae4c77d74036e8c22ff447b26d0fde8f007354fd48a7814db15b7cb",
"sha256:a068a21ceac8a4d63dbfd964670474107f541babbd2250d61922f029858365fa"
],
"version": "==2.9"
},
"imagesize": {
"hashes": [
"sha256:6965f19a6a2039c7d48bca7dba2473069ff854c36ae6f19d2cde309d998228a1",
"sha256:b1f6b5a4eab1f73479a50fb79fcf729514a900c341d8503d62a62dbc4127a2b1"
],
"version": "==1.2.0"
},
"jinja2": {
"hashes": [
"sha256:93187ffbc7808079673ef52771baa950426fd664d3aad1d0fa3e95644360e250",
"sha256:b0eaf100007721b5c16c1fc1eecb87409464edc10469ddc9a22a27a99123be49"
],
"version": "==2.11.1"
},
"markupsafe": {
"hashes": [
"sha256:00bc623926325b26bb9605ae9eae8a215691f33cae5df11ca5424f06f2d1f473",
"sha256:09027a7803a62ca78792ad89403b1b7a73a01c8cb65909cd876f7fcebd79b161",
"sha256:09c4b7f37d6c648cb13f9230d847adf22f8171b1ccc4d5682398e77f40309235",
"sha256:1027c282dad077d0bae18be6794e6b6b8c91d58ed8a8d89a89d59693b9131db5",
"sha256:13d3144e1e340870b25e7b10b98d779608c02016d5184cfb9927a9f10c689f42",
"sha256:24982cc2533820871eba85ba648cd53d8623687ff11cbb805be4ff7b4c971aff",
"sha256:29872e92839765e546828bb7754a68c418d927cd064fd4708fab9fe9c8bb116b",
"sha256:43a55c2930bbc139570ac2452adf3d70cdbb3cfe5912c71cdce1c2c6bbd9c5d1",
"sha256:46c99d2de99945ec5cb54f23c8cd5689f6d7177305ebff350a58ce5f8de1669e",
"sha256:500d4957e52ddc3351cabf489e79c91c17f6e0899158447047588650b5e69183",
"sha256:535f6fc4d397c1563d08b88e485c3496cf5784e927af890fb3c3aac7f933ec66",
"sha256:596510de112c685489095da617b5bcbbac7dd6384aeebeda4df6025d0256a81b",
"sha256:62fe6c95e3ec8a7fad637b7f3d372c15ec1caa01ab47926cfdf7a75b40e0eac1",
"sha256:6788b695d50a51edb699cb55e35487e430fa21f1ed838122d722e0ff0ac5ba15",
"sha256:6dd73240d2af64df90aa7c4e7481e23825ea70af4b4922f8ede5b9e35f78a3b1",
"sha256:717ba8fe3ae9cc0006d7c451f0bb265ee07739daf76355d06366154ee68d221e",
"sha256:79855e1c5b8da654cf486b830bd42c06e8780cea587384cf6545b7d9ac013a0b",
"sha256:7c1699dfe0cf8ff607dbdcc1e9b9af1755371f92a68f706051cc8c37d447c905",
"sha256:88e5fcfb52ee7b911e8bb6d6aa2fd21fbecc674eadd44118a9cc3863f938e735",
"sha256:8defac2f2ccd6805ebf65f5eeb132adcf2ab57aa11fdf4c0dd5169a004710e7d",
"sha256:98c7086708b163d425c67c7a91bad6e466bb99d797aa64f965e9d25c12111a5e",
"sha256:9add70b36c5666a2ed02b43b335fe19002ee5235efd4b8a89bfcf9005bebac0d",
"sha256:9bf40443012702a1d2070043cb6291650a0841ece432556f784f004937f0f32c",
"sha256:ade5e387d2ad0d7ebf59146cc00c8044acbd863725f887353a10df825fc8ae21",
"sha256:b00c1de48212e4cc9603895652c5c410df699856a2853135b3967591e4beebc2",
"sha256:b1282f8c00509d99fef04d8ba936b156d419be841854fe901d8ae224c59f0be5",
"sha256:b2051432115498d3562c084a49bba65d97cf251f5a331c64a12ee7e04dacc51b",
"sha256:ba59edeaa2fc6114428f1637ffff42da1e311e29382d81b339c1817d37ec93c6",
"sha256:c8716a48d94b06bb3b2524c2b77e055fb313aeb4ea620c8dd03a105574ba704f",
"sha256:cd5df75523866410809ca100dc9681e301e3c27567cf498077e8551b6d20e42f",
"sha256:cdb132fc825c38e1aeec2c8aa9338310d29d337bebbd7baa06889d09a60a1fa2",
"sha256:e249096428b3ae81b08327a63a485ad0878de3fb939049038579ac0ef61e17e7",
"sha256:e8313f01ba26fbbe36c7be1966a7b7424942f670f38e666995b88d012765b9be"
],
"version": "==1.1.1"
},
"packaging": {
"hashes": [
"sha256:170748228214b70b672c581a3dd610ee51f733018650740e98c7df862a583f73",
"sha256:e665345f9eef0c621aa0bf2f8d78cf6d21904eef16a93f020240b704a57f1334"
],
"version": "==20.1"
},
"pygments": {
"hashes": [
"sha256:2a3fe295e54a20164a9df49c75fa58526d3be48e14aceba6d6b1e8ac0bfd6f1b",
"sha256:98c8aa5a9f778fcd1026a17361ddaf7330d1b7c62ae97c3bb0ae73e0b9b6b0fe"
],
"version": "==2.5.2"
},
"pyparsing": {
"hashes": [
"sha256:4c830582a84fb022400b85429791bc551f1f4871c33f23e44f353119e92f969f",
"sha256:c342dccb5250c08d45fd6f8b4a559613ca603b57498511740e65cd11a2e7dcec"
],
"version": "==2.4.6"
},
"pytz": {
"hashes": [
"sha256:1c557d7d0e871de1f5ccd5833f60fb2550652da6be2693c1e02300743d21500d",
"sha256:b02c06db6cf09c12dd25137e563b31700d3b80fcc4ad23abb7a315f2789819be"
],
"index": "pypi",
"version": "==2019.3"
},
"releases": {
"hashes": [
"sha256:555ae4c97a671a420281c1c782e9236be25157b449fdf20b4c4b293fe93db2f1",
"sha256:cb3435ba372a6807433800fbe473760cfa781171513f670f3c4b76983ac80f18"
],
"index": "pypi",
"version": "==1.6.3"
},
"requests": {
"hashes": [
"sha256:43999036bfa82904b6af1d99e4882b560e5e2c68e5c4b0aa03b655f3d7d73fee",
"sha256:b3f43d496c6daba4493e7c431722aeb7dbc6288f52a6e04e7b6023b0247817e6"
],
"version": "==2.23.0"
},
"semantic-version": {
"hashes": [
"sha256:2a4328680073e9b243667b201119772aefc5fc63ae32398d6afafff07c4f54c0",
"sha256:2d06ab7372034bcb8b54f2205370f4aa0643c133b7e6dbd129c5200b83ab394b"
],
"version": "==2.6.0"
},
"six": {
"hashes": [
"sha256:236bdbdce46e6e6a3d61a337c0f8b763ca1e8717c03b369e87a7ec7ce1319c0a",
"sha256:8f3cd2e254d8f793e7f3d6d9df77b92252b52637291d0f0da013c76ea2724b6c"
],
"version": "==1.14.0"
},
"snowballstemmer": {
"hashes": [
"sha256:209f257d7533fdb3cb73bdbd24f436239ca3b2fa67d56f6ff88e86be08cc5ef0",
"sha256:df3bac3df4c2c01363f3dd2cfa78cce2840a79b9f1c2d2de9ce8d31683992f52"
],
"version": "==2.0.0"
},
"sphinx": {
"hashes": [
"sha256:776ff8333181138fae52df65be733127539623bb46cc692e7fa0fcfc80d7aa88",
"sha256:ca762da97c3b5107cbf0ab9e11d3ec7ab8d3c31377266fd613b962ed971df709"
],
"index": "pypi",
"version": "==2.4.3"
},
"sphinxcontrib-applehelp": {
"hashes": [
"sha256:806111e5e962be97c29ec4c1e7fe277bfd19e9652fb1a4392105b43e01af885a",
"sha256:a072735ec80e7675e3f432fcae8610ecf509c5f1869d17e2eecff44389cdbc58"
],
"version": "==1.0.2"
},
"sphinxcontrib-devhelp": {
"hashes": [
"sha256:8165223f9a335cc1af7ffe1ed31d2871f325254c0423bc0c4c7cd1c1e4734a2e",
"sha256:ff7f1afa7b9642e7060379360a67e9c41e8f3121f2ce9164266f61b9f4b338e4"
],
"version": "==1.0.2"
},
"sphinxcontrib-htmlhelp": {
"hashes": [
"sha256:3c0bc24a2c41e340ac37c85ced6dafc879ab485c095b1d65d2461ac2f7cca86f",
"sha256:e8f5bb7e31b2dbb25b9cc435c8ab7a79787ebf7f906155729338f3156d93659b"
],
"version": "==1.0.3"
},
"sphinxcontrib-jsmath": {
"hashes": [
"sha256:2ec2eaebfb78f3f2078e73666b1415417a116cc848b72e5172e596c871103178",
"sha256:a9925e4a4587247ed2191a22df5f6970656cb8ca2bd6284309578f2153e0c4b8"
],
"version": "==1.0.1"
},
"sphinxcontrib-qthelp": {
"hashes": [
"sha256:4c33767ee058b70dba89a6fc5c1892c0d57a54be67ddd3e7875a18d14cba5a72",
"sha256:bd9fc24bcb748a8d51fd4ecaade681350aa63009a347a8c14e637895444dfab6"
],
"version": "==1.0.3"
},
"sphinxcontrib-serializinghtml": {
"hashes": [
"sha256:eaa0eccc86e982a9b939b2b82d12cc5d013385ba5eadcc7e4fed23f4405f77bc",
"sha256:f242a81d423f59617a8e5cf16f5d4d74e28ee9a66f9e5b637a18082991db5a9a"
],
"version": "==1.1.4"
},
"urllib3": {
"hashes": [
"sha256:2f3db8b19923a873b3e5256dc9c2dedfa883e33d87c690d9c7913e1f40673cdc",
"sha256:87716c2d2a7121198ebcb7ce7cccf6ce5e9ba539041cfbaeecfb641dc0bf6acc"
],
"version": "==1.25.8"
}
}
}

View file

@ -10,4 +10,4 @@ customer management at `Jan Dittberner IT-Consulting & -Solutions
Read the :doc:`Installation instructions <install>` to get started locally. Read the :doc:`Installation instructions <install>` to get started locally.
The project page for gvafile is at http://dev.gnuviech-server.de/gvapgsql. The project page for gvafile is at https://git.dittberner.info/gnuviech/gvapgsql.

12
Vagrantfile vendored
View file

@ -2,7 +2,7 @@
# vi: set ft=ruby : # vi: set ft=ruby :
Vagrant.configure(2) do |config| Vagrant.configure(2) do |config|
config.vm.box = "debian/contrib-jessie64" config.vm.box = "debian/buster64"
config.vm.hostname = "gvapgsql.local" config.vm.hostname = "gvapgsql.local"
config.vm.network "private_network", ip: "172.16.3.7" config.vm.network "private_network", ip: "172.16.3.7"
@ -10,18 +10,20 @@ Vagrant.configure(2) do |config|
config.vm.synced_folder "../gvasalt/states/", "/srv/salt/" config.vm.synced_folder "../gvasalt/states/", "/srv/salt/"
config.vm.synced_folder "../gvasalt/pillar/", "/srv/pillar/" config.vm.synced_folder "../gvasalt/pillar/", "/srv/pillar/"
config.vm.provider "virtualbox" do |vb| config.vm.provider :libvirt do |libvirt|
# vb.gui = true libvirt.memory = 1024
vb.memory = "512"
end end
config.vm.provision :shell, path: "change-vmdebootstrap-default-dhcp.sh"
config.vm.provision :salt do |salt| config.vm.provision :salt do |salt|
salt.bootstrap_script = "salt/bootstrap.sh" salt.bootstrap_options = "-x python3"
salt.minion_id = "gvapgsql" salt.minion_id = "gvapgsql"
salt.masterless = true salt.masterless = true
salt.run_highstate = true salt.run_highstate = true
salt.verbose = true salt.verbose = true
salt.colorize = true salt.colorize = true
salt.log_level = "warning" salt.log_level = "warning"
salt.grains_config = "salt/grains"
end end
end end

View file

@ -0,0 +1,15 @@
#!/bin/sh
set -e
debootstrap_network=/etc/systemd/network/99-dhcp.network
if grep -q '^Name=\\*' "${debootstrap_network}"; then
primary_nic=$(ls -1 /sys/class/net | grep -v lo |sort | head -1)
sed -i "s/^Name=e\\*/Name=${primary_nic}/" \
"${debootstrap_network}"
systemctl restart systemd-networkd.service
echo "Changed systemd network configuration"
else
echo "Systemd network configuration has already been changed"
fi

View file

@ -1,6 +1,13 @@
Changelog Changelog
========= =========
* :release:`0.3.0 <2020-04-05>`
* :support:`-` add Docker setup for lightweight local testing
* :support:`-` update Vagrant setup to libvirt and Debian Buster
* :support:`-` move pgsqltasks to top level to keep the task names when
using Python 3
* :support:`-` use Pipenv for dependency management
* :release:`0.2.0 <2018-11-21>` * :release:`0.2.0 <2018-11-21>`
* :feature:`-` fix compatibility with Python 2.7 on Debian Stretch * :feature:`-` fix compatibility with Python 2.7 on Debian Stretch

View file

@ -7,30 +7,24 @@ gvapgsql is implemented as `Celery`_ app.
.. _Celery: http://www.celeryproject.org/ .. _Celery: http://www.celeryproject.org/
The project module :py:mod:`gvapgsql`
=====================================
.. automodule:: gvapgsql
:py:mod:`gvapgsql.celery`
-------------------------
.. automodule:: gvapgsql.celery
:members:
:py:mod:`gvapgsql.settings`
---------------------------
.. automodule:: gvapgsql.settings
:py:mod:`pgsqltasks` app :py:mod:`pgsqltasks` app
======================== ========================
:py:mod:`pgsqltasks.celery`
---------------------------
.. automodule:: pgsqltasks .. automodule:: pgsqltasks
.. automodule:: pgsqltasks.celery
:members:
:py:mod:`pgsqltasks.settings`
-----------------------------
.. automodule:: pgsqltasks.settings
:py:mod:`pgsqltasks.tasks` :py:mod:`pgsqltasks.tasks`
-------------------------- --------------------------

View file

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# pymode:lint_ignore=E501 # pymode:lint_ignore=E501
# #
# gvamysql documentation build configuration file, created by # gvapgsql documentation build configuration file, created by
# sphinx-quickstart on Sun Feb 17 11:46:20 2013. # sphinx-quickstart on Sun Feb 17 11:46:20 2013.
# #
# This file is execfile()d with the current directory set to its containing dir. # This file is execfile()d with the current directory set to its containing dir.
@ -21,6 +21,7 @@ import os
sys.path.insert(0, os.path.abspath(os.path.join('..', 'gvapgsql'))) sys.path.insert(0, os.path.abspath(os.path.join('..', 'gvapgsql')))
os.environ['GVAPGSQL_BROKER_URL'] = 'amqp://localhost' os.environ['GVAPGSQL_BROKER_URL'] = 'amqp://localhost'
os.environ['GVAPGSQL_RESULTS_REDIS_URL'] = 'redis://'
os.environ['GVAPGSQL_DBADMIN_HOST'] = 'localhost' os.environ['GVAPGSQL_DBADMIN_HOST'] = 'localhost'
os.environ['GVAPGSQL_DBADMIN_PORT'] = '5432' os.environ['GVAPGSQL_DBADMIN_PORT'] = '5432'
os.environ['GVAPGSQL_DBADMIN_USER'] = 'gvapgsql' os.environ['GVAPGSQL_DBADMIN_USER'] = 'gvapgsql'
@ -35,13 +36,13 @@ os.environ['GVAPGSQL_DBADMIN_PASSWORD'] = 'gvapgsql'
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones. # coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['releases', 'sphinx.ext.autodoc', 'celery.contrib.sphinx'] extensions = ['releases', 'sphinx.ext.autodoc', 'celery.contrib.sphinx']
# configuration for releases extension
releases_issue_uri = 'https://git.dittberner.info/gnuviech/gvapgsql/issues/%s'
releases_release_uri = 'https://git.dittberner.info/gnuviech/gvapgsql/src/tag/%s'
# Add any paths that contain templates here, relative to this directory. # Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates'] templates_path = ['_templates']
releases_issue_uri = 'https://dev.gnuviech-server.de/gvapgsql/ticket/%s'
releases_release_uri = 'https://dev.gnuviech-server.de/gvapgsql/milestone/%s'
# The suffix of source filenames. # The suffix of source filenames.
source_suffix = '.rst' source_suffix = '.rst'
@ -53,16 +54,17 @@ master_doc = 'index'
# General information about the project. # General information about the project.
project = u'gvapgsql' project = u'gvapgsql'
copyright = u'2015-2018 Jan Dittberner' copyright = u'2015-2020 Jan Dittberner'
# The version info for the project you're documenting, acts as replacement for # The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the # |version| and |release|, also used in various other places throughout the
# built documents. # built documents.
# #
# The short X.Y version.
version = '0.2'
# The full version, including alpha/beta/rc tags. # The full version, including alpha/beta/rc tags.
release = '0.2.0' from pgsqltasks import __version__ as release
# The short X.Y version.
version = ".".join(release.split('.')[:2])
# The language for content autogenerated by Sphinx. Refer to documentation # The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages. # for a list of supported languages.
@ -103,7 +105,7 @@ pygments_style = 'sphinx'
# The theme to use for HTML and HTML Help pages. See the documentation for # The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes. # a list of builtin themes.
html_theme = 'default' html_theme = 'alabaster'
# Theme options are theme-specific and customize the look and feel of a theme # Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the # further. For a list of options available for each theme, see the

View file

@ -7,64 +7,17 @@ Install
Working Environment Working Environment
=================== ===================
You have several options in setting up your working environment. We recommend To get a running work environment use `pipenv`_.
using virtualenv to separate the dependencies of your project from your
system's python environment. If on Linux or Mac OS X, you can also use
virtualenvwrapper to help manage multiple virtualenvs across different
projects.
.. index:: virtualenv .. _pipenv: https://pipenv.kennethreitz.org/en/latest/
Virtualenv Only To get started install `pip` and `pipenv` and use `pipenv install --dev`:
---------------
First, make sure you are using `virtualenv`_. Once that's installed, create
your virtualenv:
.. code-block:: sh .. code-block:: sh
$ virtualenv --distribute gvapgsql $ apt install python3-pip
$ python3 -m pip install --user -U pipenv
.. _virtualenv: https://virtualenv.pypa.io/en/latest/ $ pipenv install --dev
You will also need to ensure that the virtualenv has the project directory
added to the path.
.. index:: virtualenvwrapper
Virtualenv with virtualenvwrapper
------------------------------------
In Linux and Mac OSX, you can install `virtualenvwrapper
<http://virtualenvwrapper.readthedocs.org/en/latest/>`_, which will take care
of managing your virtual environments and adding the project path to the
`site-directory` for you:
.. code-block:: sh
$ mkdir gvapgsql
$ mkvirtualenv -a gvapgsql gvapgsql-dev
$ cd gvapgsql && add2virtualenv `pwd`
.. index:: pip, requirements, dependencies
Installation of Dependencies
=============================
Depending on where you are installing dependencies:
In development:
.. code-block:: sh
$ pip install -r requirements/local.txt
For production:
.. code-block:: sh
$ pip install -r requirements.txt
.. index:: celery, worker, file queue .. index:: celery, worker, file queue
@ -78,6 +31,6 @@ into the gvapgsql directory and run the celery worker with:
.. code-block:: sh .. code-block:: sh
$ cd gvapgsql $ cd gvapgsql
$ celery -A gvapgsql worker -Q pgsql -l info $ pipenv run celery -A pgsqltasks worker -Q web -l info
.. _Celery: http://www.celeryproject.org/ .. _Celery: http://www.celeryproject.org/

7
gvapgsql.sh Executable file
View file

@ -0,0 +1,7 @@
#!/bin/sh
set -e
. /home/gvapgsql/gvapgsql-venv/bin/activate
cd /srv/gvapgsql/gvapgsql
celery -A pgsqltasks worker -Q pgsql -l info

View file

@ -1,3 +0,0 @@
.*.swp
*.pyc
.ropeproject/

View file

@ -3,13 +3,8 @@ from __future__ import unicode_literals
class GvaRouter(object): class GvaRouter(object):
def route_for_task(self, task, args=None, kwargs=None): def route_for_task(self, task, args=None, kwargs=None):
for route in ['ldap', 'file', 'mysql', 'pgsql']: for route in ["ldap", "file", "mysql", "pgsql"]:
if route in task: if route in task:
return { return {"exchange": route, "exchange_type": "direct", "queue": route}
'exchange': route,
'exchange_type': 'direct',
'queue': route,
}
return None return None

View file

@ -1,15 +0,0 @@
"""
This module defines the Celery_ app for gvapgsql.
.. _Celery: http://www.celeryproject.org/
"""
from __future__ import absolute_import
from celery import Celery
#: The Celery application
app = Celery('gvapgsql')
app.config_from_object('gvapgsql.settings')
app.autodiscover_tasks(['pgsqltasks'], force=True)

View file

@ -2,3 +2,9 @@
This module contains :py:mod:`pgsqltasks.tasks`. This module contains :py:mod:`pgsqltasks.tasks`.
""" """
__version__ = "0.3.0"
from pgsqltasks.celery import app as celery_app
__all__ = ("celery_app",)

View file

@ -0,0 +1,13 @@
"""
This module defines the Celery_ app for gvapgsql.
.. _Celery: http://www.celeryproject.org/
"""
from celery import Celery
#: The Celery application
app = Celery("pgsqltasks")
app.config_from_object("pgsqltasks.settings", namespace="CELERY")
app.autodiscover_tasks(["pgsqltasks.tasks"], force=True)

View file

@ -1,4 +0,0 @@
"""
Empty models to make Django accept pgsqltasks as an app.
"""

View file

@ -25,23 +25,21 @@ def get_env_setting(setting):
########## CELERY CONFIGURATION ########## CELERY CONFIGURATION
CELERY_TIMEZONE = 'Europe/Berlin' CELERY_BROKER_URL = get_env_setting("GVAPGSQL_BROKER_URL")
CELERY_ENABLE_UTC = True CELERY_RESULT_BACKEND = get_env_setting("GVAPGSQL_RESULTS_REDIS_URL")
CELERY_RESULT_BACKEND = 'amqp'
CELERY_RESULT_PERSISTENT = True CELERY_RESULT_PERSISTENT = True
CELERY_TASK_RESULT_EXPIRES = None CELERY_TASK_RESULT_EXPIRES = None
CELERY_ROUTES = ( CELERY_ROUTES = ("gvacommon.celeryrouters.GvaRouter",)
'gvacommon.celeryrouters.GvaRouter', CELERY_TIMEZONE = "Europe/Berlin"
) CELERY_ENABLE_UTC = True
CELERY_ACCEPT_CONTENT = ['json'] CELERY_ACCEPT_CONTENT = ["json"]
CELERY_TASK_SERIALIZER = 'json' CELERY_TASK_SERIALIZER = "json"
CELERY_RESULT_SERIALIZER = 'json' CELERY_RESULT_SERIALIZER = "json"
BROKER_URL = get_env_setting('GVAPGSQL_BROKER_URL')
########## END CELERY CONFIGURATION ########## END CELERY CONFIGURATION
########## GVAPGSQL CONFIGURATION ########## GVAPGSQL CONFIGURATION
GVAPGSQL_DBADMIN_HOST = get_env_setting('GVAPGSQL_DBADMIN_HOST') GVAPGSQL_DBADMIN_HOST = get_env_setting("GVAPGSQL_DBADMIN_HOST")
GVAPGSQL_DBADMIN_PORT = int(get_env_setting('GVAPGSQL_DBADMIN_PORT')) GVAPGSQL_DBADMIN_PORT = int(get_env_setting("GVAPGSQL_DBADMIN_PORT"))
GVAPGSQL_DBADMIN_USER = get_env_setting('GVAPGSQL_DBADMIN_USER') GVAPGSQL_DBADMIN_USER = get_env_setting("GVAPGSQL_DBADMIN_USER")
GVAPGSQL_DBADMIN_PASSWORD = get_env_setting('GVAPGSQL_DBADMIN_PASSWORD') GVAPGSQL_DBADMIN_PASSWORD = get_env_setting("GVAPGSQL_DBADMIN_PASSWORD")
########## END GVAPGSQL CONFIGURATION ########## END GVAPGSQL CONFIGURATION

View file

@ -2,15 +2,12 @@
This module defines Celery_ tasks to manage PostgreSQL users and databases. This module defines Celery_ tasks to manage PostgreSQL users and databases.
""" """
from __future__ import absolute_import
from celery import shared_task from celery import shared_task
from celery.utils.log import get_task_logger from celery.utils.log import get_task_logger
from gvapgsql import settings
from psycopg2 import connect from psycopg2 import connect
from psycopg2.extensions import ISQLQuote from psycopg2.extensions import ISQLQuote
from pgsqltasks import settings
_LOGGER = get_task_logger(__name__) _LOGGER = get_task_logger(__name__)
@ -56,7 +53,7 @@ def _get_connection():
port=settings.GVAPGSQL_DBADMIN_PORT, port=settings.GVAPGSQL_DBADMIN_PORT,
user=settings.GVAPGSQL_DBADMIN_USER, user=settings.GVAPGSQL_DBADMIN_USER,
password=settings.GVAPGSQL_DBADMIN_PASSWORD, password=settings.GVAPGSQL_DBADMIN_PASSWORD,
database='postgres', database="postgres",
) )
@ -77,11 +74,10 @@ def create_pgsql_user(username, password):
""" """
CREATE USER %(username)s WITH PASSWORD %(password)s CREATE USER %(username)s WITH PASSWORD %(password)s
""", """,
{'username': Ident(username), 'password': password} {"username": Ident(username), "password": password},
) )
@shared_task @shared_task
def set_pgsql_userpassword(username, password): def set_pgsql_userpassword(username, password):
""" """
@ -99,7 +95,7 @@ def set_pgsql_userpassword(username, password):
""" """
ALTER ROLE %(username)s WITH PASSWORD %(password)s ALTER ROLE %(username)s WITH PASSWORD %(password)s
""", """,
{'username': Ident(username), 'password': password} {"username": Ident(username), "password": password},
) )
@ -119,7 +115,7 @@ def delete_pgsql_user(username):
""" """
DROP ROLE %(username)s DROP ROLE %(username)s
""", """,
{'username': Ident(username)} {"username": Ident(username)},
) )
@ -142,7 +138,7 @@ def create_pgsql_database(dbname, username):
CREATE DATABASE %(dbname)s OWNER %(username)s CREATE DATABASE %(dbname)s OWNER %(username)s
TEMPLATE template0 ENCODING 'UTF8' TEMPLATE template0 ENCODING 'UTF8'
""", """,
{'dbname': Ident(dbname), 'username': Ident(username)} {"dbname": Ident(dbname), "username": Ident(username)},
) )
@ -163,5 +159,5 @@ def delete_pgsql_database(dbname):
""" """
DROP DATABASE %(dbname)s DROP DATABASE %(dbname)s
""", """,
{'dbname': Ident(dbname)} {"dbname": Ident(dbname)},
) )

18
gvapgsql/setup.cfg Normal file
View file

@ -0,0 +1,18 @@
[coverage:run]
source = gvacommon,pgsqltasks
branch = True
omit = */tests/*.py,*/tests.py
relative_files = True
[coverage:report]
show_missing = True
[coverage:html]
directory = ../coverage-report
[isort]
multi_line_output = 3
line_length = 88
known_third_party = celery,psycopg2
include_trailing_comma = True
sections = FUTURE,STDLIB,THIRDPARTY,FIRSTPARTY,LOCALFOLDER

View file

@ -1,3 +0,0 @@
# This file is here because many Platforms as a Service look for
# requirements.txt in the root directory of a project.
-r requirements/production.txt

View file

@ -1,8 +0,0 @@
amqp==1.4.9
bpython==0.13.1
anyjson==0.3.3
billiard==3.3.0.19
celery==3.1.17
kombu==3.0.37
pytz==2014.10
psycopg2==2.5.4

View file

@ -1,6 +0,0 @@
# Local development dependencies go here
-r base.txt
coverage==3.7.1
Sphinx==1.2.3
sqlparse==0.1.14
releases==0.7.0

View file

@ -1,3 +0,0 @@
# Pro-tip: Try not to put anything here. There should be no dependency in
# production that isn't in development.
-r base.txt

View file

@ -1,3 +0,0 @@
# Test dependencies go here.
-r base.txt
coverage==3.7.1

View file

@ -1,38 +0,0 @@
#!/bin/sh -
echo "deb http://httpredir.debian.org/debian jessie-backports main" >/etc/apt/sources.list.d/backports.list
apt-get update
apt-get install -y -t jessie-backports python-cryptography
# We just download the bootstrap script by default and execute that.
if [ -x /usr/bin/fetch ]; then
/usr/bin/fetch -o - https://raw.githubusercontent.com/saltstack/salt-bootstrap/stable/bootstrap-salt.sh | sh -s -- "$@"
elif [ -x /usr/bin/curl ]; then
/usr/bin/curl -L https://raw.githubusercontent.com/saltstack/salt-bootstrap/stable/bootstrap-salt.sh | sh -s -- "$@"
else
python \
-c 'import urllib; print urllib.urlopen("https://raw.githubusercontent.com/saltstack/salt-bootstrap/stable/bootstrap-salt.sh").read()' \
| sh -s -- "$@"
fi
cat >/etc/salt/minion <<EOF
file_client: local
file_roots:
base:
- /srv/salt/
pillar_roots:
base:
- /srv/pillar
log_file: file:///dev/log
EOF
umask 077
cat >/etc/salt/grains <<EOF
roles:
- postgresql-server
- gnuviechadmin.gvapgsql
EOF

10
salt/grains Normal file
View file

@ -0,0 +1,10 @@
gnuviechadmin:
user: vagrant
group: vagrant
checkout: /vagrant
home: /home/vagrant
update_git: False
roles:
- vagrant
- gnuviechadmin.gvapgsql
- gnuviechadmin.database

11
salt/minion Normal file
View file

@ -0,0 +1,11 @@
file_client: local
file_roots:
base:
- /srv/salt/
pillar_roots:
base:
- /srv/pillar
log_file: file:///dev/log