Commit 1f3113f2 authored by EKbfh's avatar EKbfh 🐼
Browse files

Merge branch 'py3' into 'master'

Python3

See merge request !48
parents c3d54953 e7bac1e0
Pipeline #23004 passed with stages
in 7 minutes and 38 seconds
......@@ -18,3 +18,5 @@ var/
.gitlab-ci.yml
.bumpversion.cfg
.flake8
venv*/
.mypy_cache/
......@@ -16,3 +16,5 @@ config*.db
tower/ui/pkg/webix/webix_debug.js
.pytest_cache/
.tox
venv*
.mypy_cache/
......@@ -56,7 +56,6 @@ check_docker_buildable_debian:
script:
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
- docker build -t ${CI_COMMIT_REF_SLUG}-${CI_JOB_ID} -f contrib/docker/Dockerfile .
#- timeout --preserve-status -s 9 30 docker run ${CI_COMMIT_REF_SLUG}-${CI_JOB_ID}
tags:
- shell
......@@ -65,7 +64,6 @@ check_docker_buildable_alpine:
script:
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
- docker build -t ${CI_COMMIT_REF_SLUG}-${CI_JOB_ID} -f contrib/docker/Dockerfile.alpine .
#- timeout --preserve-status -s 9 30 docker run ${CI_COMMIT_REF_SLUG}-${CI_JOB_ID}
tags:
- shell
......
#!/bin/sh
cd `dirname $0`/..
./bin/pip install https://cdn.getnoc.com/tower/noc-tower-latest.zip
FROM python:2.7.16 as builder
FROM debian:buster as builder
RUN mkdir /mnt/tower
WORKDIR /mnt/tower/
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
python3-venv \
python3-setuptools
COPY ../.. /mnt/tower/
RUN python setup.py sdist --format=zip
RUN python3 setup.py sdist --format=zip
WORKDIR /opt/tower
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential
RUN virtualenv /opt/tower \
RUN python3 -m venv /opt/tower \
&& ./bin/pip install /mnt/tower/dist/*.zip
FROM debian:latest as app
FROM debian:buster as app
ENV ANSIBLE_HOST_KEY_CHECKING=False \
ANSIBLE_SSH_PIPELINING=1 \
ANSIBLE_STDOUT_CALLBACK=debug \
PYTHONUNBUFFERED=1 \
PATH=/opt/tower/bin:${PATH} \
PYTHONPATH=/opt/tower/lib/python2.7:/usr/lib/python2.7
PYTHONPATH=/opt/tower/lib/python3.7:/usr/lib/python3.7
COPY --from=builder /opt/tower /opt/tower
# install systemv packages
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
libpython2.7 \
libpython2.7-stdlib \
libpython3.7 \
libpython3.7-stdlib \
libpython-stdlib \
python2.7 \
python-minimal \
python3 \
ca-certificates \
openssh-client \
openssl \
git \
&& rm -rf /var/cache/apk/* \
&& rm -rf /var/lib/apt/lists/* \
# Fix for https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=783738
&& ln -s /usr/lib/python2.7/plat-*/_sysconfigdata_nd.py /usr/lib/python2.7/ \
&& update-alternatives --install /usr/bin/python python /usr/bin/python3.7 3 \
&& adduser --system \
--shell /bin/bash \
--no-create-home \
......
FROM alpine:3.9 as builder
FROM alpine:3.11 as builder
RUN mkdir /mnt/tower
WORKDIR /mnt/tower/
RUN apk add --no-cache --update \
py2-cffi \
py-virtualenv \
py3-cffi \
py3-virtualenv \
gcc \
python-dev \
python3-dev \
musl-dev \
libffi-dev \
openssl-dev \
ca-certificates \
make
COPY . /mnt/tower/
RUN python setup.py sdist --format=zip
RUN python3 setup.py sdist --format=zip
WORKDIR /opt/tower
RUN virtualenv /opt/tower \
&& ./bin/pip install /mnt/tower/dist/*.zip
&& ./bin/pip3 install /mnt/tower/dist/*.zip
FROM python:2.7-alpine3.9
FROM python:3.8-alpine3.11
ENV ANSIBLE_HOST_KEY_CHECKING=False \
ANSIBLE_SSH_PIPELINING=1 \
......@@ -27,7 +27,7 @@ ENV ANSIBLE_HOST_KEY_CHECKING=False \
PYTHONUNBUFFERED=1 \
PS1="\$(date +%H:%M:%S) \h \w \\$ " \
PATH=/opt/tower/bin:${PATH} \
PYTHONPATH=/opt/tower/lib/python2.7/site-packages/:/usr/local/lib/python2.7:/usr/local/lib/python2.7/site-packages
PYTHONPATH=/opt/tower/lib/python3.8/site-packages/:/usr/local/lib/python3.8:/usr/local/lib/python3.8/site-packages
COPY --from=builder /opt/tower /opt/tower
......
......@@ -15,5 +15,5 @@ setuptools>=11.3
packaging
appdirs
netaddr
#gittornado
jmespath==0.9.3
future==0.18.2
......@@ -66,7 +66,6 @@ def main():
"console_scripts": [
"tower-inv = tower.cli.inv:main",
"tower-pull = tower.cli.pull:main",
"tower-collect-crashinfo = tower.cli.crashinfo:main",
"tower-web = tower.daemons.web:run",
"tower-dump = tower.cli.backup:dump",
"tower-restore = tower.cli.backup:restore"
......@@ -76,7 +75,6 @@ def main():
"tower": tower_data
},
data_files=["VERSION"],
scripts=["bin/tower-upgrade"],
install_requires=requirements,
zip_safe=False,
classifiers=[
......
{
"_meta": {
"hostvars": {
"clickhouse01": {
"ansible_connection": "ssh",
"ansible_host": "192.168.3.31",
"ansible_port": 22,
"ansible_python_interpreter": "/usr/bin/python",
"ansible_shell_type": "sh",
"ansible_ssh_pipelining": true,
"ansible_ssh_private_key_file": null,
"ansible_user": "ansible",
"has_svc_consul": true,
"has_svc_consul_template": true,
"has_svc_noc": true,
"has_svc_nsqd": true,
"noc_dc": "kr01",
"node_id": 7,
"required_assets": []
},
"clickhouse02": {
"ansible_connection": "ssh",
"ansible_host": "192.168.3.32",
"ansible_port": 22,
"ansible_python_interpreter": "/usr/bin/python",
"ansible_shell_type": "sh",
"ansible_ssh_pipelining": true,
"ansible_ssh_private_key_file": null,
"ansible_user": "ansible",
"has_svc_bi": true,
"has_svc_ch_datasource": true,
"has_svc_chwriter": true,
"has_svc_clickhouse": true,
"has_svc_consul": true,
"has_svc_consul_template": true,
"has_svc_noc": true,
"has_svc_nsqd": true,
"noc_dc": "sdc",
"node_id": 6,
"required_assets": [
"bi"
]
},
"collector": {
"ansible_connection": "ssh",
"ansible_host": "192.168.1.63",
"ansible_port": 22,
"ansible_python_interpreter": "/usr/bin/python",
"ansible_shell_type": "sh",
"ansible_ssh_pipelining": true,
"ansible_ssh_private_key_file": null,
"ansible_user": "ansible",
"has_svc_consul": true,
"has_svc_consul_template": true,
"has_svc_noc": true,
"has_svc_nsqd": true,
"has_svc_postgres": true,
"has_svc_syslogcollector": true,
"has_svc_trapcollector": true,
"noc_dc": "kr01",
"node_id": 1,
"required_assets": []
},
"discovery01": {
"ansible_connection": "ssh",
"ansible_host": "192.168.1.66",
"ansible_port": 22,
"ansible_python_interpreter": "/usr/bin/python",
"ansible_shell_type": "sh",
"ansible_ssh_pipelining": true,
"ansible_ssh_private_key_file": null,
"ansible_user": "ansible",
"has_svc_classifier": true,
"has_svc_consul": true,
"has_svc_consul_template": true,
"has_svc_correlator": true,
"has_svc_discovery": true,
"has_svc_escalator": true,
"has_svc_mailsender": true,
"has_svc_noc": true,
"has_svc_nsqd": true,
"has_svc_sae": true,
"has_svc_scheduler": true,
"has_svc_tgsender": true,
"noc_dc": "kr01",
"node_id": 9,
"required_assets": []
},
"discovery02": {
"ansible_connection": "ssh",
"ansible_host": "192.168.2.66",
"ansible_port": 22,
"ansible_python_interpreter": "/usr/bin/python",
"ansible_shell_type": "sh",
"ansible_ssh_pipelining": true,
"ansible_ssh_private_key_file": null,
"ansible_user": "ansible",
"has_svc_classifier": true,
"has_svc_consul": true,
"has_svc_consul_template": true,
"has_svc_correlator": true,
"has_svc_discovery": true,
"has_svc_escalator": true,
"has_svc_mailsender": true,
"has_svc_noc": true,
"has_svc_nsqd": true,
"has_svc_sae": true,
"has_svc_scheduler": true,
"has_svc_tgsender": true,
"noc_dc": "sdc",
"node_id": 8,
"required_assets": []
},
"influxdb01": {
"ansible_connection": "ssh",
"ansible_host": "192.168.1.61",
"ansible_port": 22,
"ansible_python_interpreter": "/usr/bin/python",
"ansible_shell_type": "sh",
"ansible_ssh_pipelining": true,
"ansible_ssh_private_key_file": null,
"ansible_user": "ansible",
"has_svc_consul": true,
"has_svc_consul_template": true,
"has_svc_noc": true,
"has_svc_nsqd": true,
"noc_dc": "kr01",
"node_id": 5,
"required_assets": []
},
"mongodb01": {
"ansible_connection": "ssh",
"ansible_host": "192.168.1.62",
"ansible_port": 22,
"ansible_python_interpreter": "/usr/bin/python",
"ansible_shell_type": "sh",
"ansible_ssh_pipelining": true,
"ansible_ssh_private_key_file": null,
"ansible_user": "ansible",
"has_svc_consul": true,
"has_svc_consul_template": true,
"has_svc_mongod": true,
"has_svc_noc": true,
"has_svc_nsqd": true,
"has_svc_nsqlookupd": true,
"noc_dc": "kr01",
"node_id": 4,
"required_assets": []
},
"mongodb02": {
"ansible_connection": "ssh",
"ansible_host": "192.168.1.65",
"ansible_port": 22,
"ansible_python_interpreter": "/usr/bin/python",
"ansible_shell_type": "sh",
"ansible_ssh_pipelining": true,
"ansible_ssh_private_key_file": null,
"ansible_user": "ansible",
"has_svc_consul": true,
"has_svc_consul_template": true,
"has_svc_mongod": true,
"has_svc_noc": true,
"has_svc_nsqd": true,
"has_svc_nsqlookupd": true,
"noc_dc": "kr01",
"node_id": 2,
"required_assets": []
},
"mongodb03": {
"ansible_connection": "ssh",
"ansible_host": "192.168.2.65",
"ansible_port": 22,
"ansible_python_interpreter": "/usr/bin/python",
"ansible_shell_type": "sh",
"ansible_ssh_pipelining": true,
"ansible_ssh_private_key_file": null,
"ansible_user": "ansible",
"has_svc_consul": true,
"has_svc_consul_template": true,
"has_svc_mongod": true,
"has_svc_noc": true,
"has_svc_nsqd": true,
"has_svc_nsqlookupd": true,
"noc_dc": "sdc",
"node_id": 3,
"required_assets": []
},
"web01": {
"ansible_connection": "ssh",
"ansible_host": "192.168.3.51",
"ansible_port": 22,
"ansible_python_interpreter": "/usr/bin/python",
"ansible_shell_type": "sh",
"ansible_ssh_pipelining": true,
"ansible_ssh_private_key_file": null,
"ansible_user": "ansible",
"has_svc_card": true,
"has_svc_consul": true,
"has_svc_consul_template": true,
"has_svc_grafana": true,
"has_svc_grafanads": true,
"has_svc_login": true,
"has_svc_noc": true,
"has_svc_nsqd": true,
"noc_dc": "kr01",
"node_id": 12,
"required_assets": [
"card",
"web"
]
},
"web02": {
"ansible_connection": "ssh",
"ansible_host": "192.168.3.52",
"ansible_port": 22,
"ansible_python_interpreter": "/usr/bin/python",
"ansible_shell_type": "sh",
"ansible_ssh_pipelining": true,
"ansible_ssh_private_key_file": null,
"ansible_user": "ansible",
"has_svc_card": true,
"has_svc_consul": true,
"has_svc_consul_template": true,
"has_svc_grafana": true,
"has_svc_grafanads": true,
"has_svc_login": true,
"has_svc_noc": true,
"has_svc_nsqd": true,
"noc_dc": "sdc",
"node_id": 13,
"required_assets": [
"card",
"web"
]
},
"wrk01": {
"ansible_connection": "ssh",
"ansible_host": "192.168.1.67",
"ansible_port": 22,
"ansible_python_interpreter": "/usr/bin/python",
"ansible_shell_type": "sh",
"ansible_ssh_pipelining": true,
"ansible_ssh_private_key_file": null,
"ansible_user": "ansible",
"has_svc_activator": true,
"has_svc_consul": true,
"has_svc_consul_template": true,
"has_svc_mrt": true,
"has_svc_noc": true,
"has_svc_nsqd": true,
"has_svc_ping": true,
"has_svc_web": true,
"noc_dc": "kr01",
"node_id": 11,
"required_assets": [
"mib",
"web"
]
},
"wrk02": {
"ansible_connection": "ssh",
"ansible_host": "192.168.2.67",
"ansible_port": 22,
"ansible_python_interpreter": "/usr/bin/python",
"ansible_shell_type": "sh",
"ansible_ssh_pipelining": true,
"ansible_ssh_private_key_file": null,
"ansible_user": "ansible",
"has_svc_activator": true,
"has_svc_consul": true,
"has_svc_consul_template": true,
"has_svc_mrt": true,
"has_svc_noc": true,
"has_svc_nsqd": true,
"has_svc_ping": true,
"has_svc_web": true,
"noc_dc": "sdc",
"node_id": 10,
"required_assets": [
"mib",
"web"
]
}
}
},
"all": {
"vars": {
"config_order": "yaml:///opt/noc/etc/tower.yml,yaml:///opt/noc/etc/settings.yml,env:///NOC",
"install_method": "git",
"installation_type": "prod",
"noc_all_pools": [
{
"description": "Default pool for some.ru",
"name": "default"
},
{
"description": "",
"name": "test"
}
],
"noc_env": "NOC",
"noc_env_type": "prod",
"noc_installation_name": "noc",
"noc_web_host": "noc",
"playbook_link": "git+https://github.com/nocproject/ansible_deploy@microservices",
"tower_data": "/home/shirokih/projects/tower/venv3/var/tower/data/NOC",
"tower_ssh_keys": "/home/shirokih/projects/tower/venv3/var/tower/ssh/NOC"
}
},
"cfg-activator-default-wrk01": {
"hosts": [
"wrk01"
],
"vars": {
"activator_loglevel": "info",
"activator_power": 4,
"activator_script_threads": 200
}
},
"cfg-activator-default-wrk02": {
"hosts": [
"wrk02"
],
"vars": {
"activator_loglevel": "info",
"activator_power": 4,
"activator_script_threads": 200
}
},
"cfg-bi-clickhouse02": {
"hosts": [
"clickhouse02"
],
"vars": {
"bi_language": "ru",
"bi_loglevel": "info",
"bi_power": 2
}
},
"cfg-card-web01": {
"hosts": [
"web01"
],
"vars": {
"card_language": "ru",
"card_loglevel": "info",
"card_power": 2
}
},
"cfg-card-web02": {
"hosts": [
"web02"
],
"vars": {
"card_language": "ru",
"card_loglevel": "info",
"card_power": 2
}
},
"cfg-ch_datasource-clickhouse02": {
"hosts": [
"clickhouse02"
],
"vars": {
"ch_datasource_loglevel": "info",
"ch_datasource_power": 2
}
},
"cfg-chwriter-clickhouse02": {
"hosts": [
"clickhouse02"
],
"vars": {
"chwriter_loglevel": "info",
"chwriter_power": 2
}
},
"cfg-classifier-default-discovery01": {
"hosts": [
"discovery01"
],
"vars": {
"classifier_loglevel": "info",
"classifier_lookup_solution": "noc.services.classifier.rulelookup.RuleLookup",
"classifier_power": 32
}
},
"cfg-classifier-default-discovery02": {
"hosts": [
"discovery02"
],
"vars": {
"classifier_loglevel": "info",
"classifier_lookup_solution": "noc.services.classifier.rulelookup.RuleLookup",
"classifier_power": 32
}
},
"cfg-clickhouse-clickhouse02": {
"hosts": [
"clickhouse02"
],
"vars": {
"clickhouse_loglevel": "info"
}
},
"cfg-consul-clickhouse01": {
"hosts": [
"clickhouse01"
],
"vars": {
"consul_loglevel": "info",
"consul_power": "agent"
}
},
"cfg-consul-clickhouse02": {
"hosts": [
"clickhouse02"
],
"vars": {
"consul_loglevel": "info",
"consul_power": "agent"
}
},
"cfg-consul-collector": {
"hosts": [
"collector"
],
"vars": {
"consul_loglevel": "info",
"consul_power": "agent"
}
},
"cfg-consul-discovery01": {
"hosts": [
"discovery01"
],
"vars": {
"consul_loglevel": "info",
"consul_power": "agent"
}
},
"cfg-consul-discovery02": {
"hosts": [
"discovery02"
],
"vars": {