Skip to content

Commit 3c8ffac

Browse files
Working Docker setup with python3 (#684)
* Docker changes * working changes * update noauth.py * Docker setup * changing passwrod * Revert "changing passwrod" This reverts commit 62cd1dd. * Healthcheck & Freshping addition * removing mysql password * config changes
1 parent 7a72bcc commit 3c8ffac

17 files changed

+21334
-8
lines changed

Dockerfile

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
FROM ubuntu:20.04
2+
ENV DEBIAN_FRONTEND noninteractive
3+
4+
RUN apt-get update && apt-get -y dist-upgrade \
5+
&& apt-get -y install libffi-dev libsasl2-dev python3-dev libyaml-dev sudo \
6+
libldap2-dev libssl-dev python3-pip python3-setuptools python3-venv \
7+
mysql-client nginx uwsgi uwsgi-plugin-python3 uwsgi-plugin-gevent-python3 \
8+
&& pip3 install mysql-connector-python \
9+
&& rm -rf /var/cache/apt/archives/*
10+
11+
RUN useradd -m -s /bin/bash iris
12+
13+
COPY src /home/iris/source/src
14+
COPY setup.py /home/iris/source/setup.py
15+
COPY MANIFEST.in /home/iris/source/MANIFEST.in
16+
COPY README.md /home/iris/source/README.md
17+
18+
WORKDIR /home/iris
19+
20+
RUN chown -R iris:iris /home/iris/source /var/log/nginx /var/lib/nginx \
21+
&& sudo -Hu iris mkdir -p /home/iris/var/log/uwsgi /home/iris/var/log/nginx /home/iris/var/run /home/iris/var/relay \
22+
&& sudo -Hu iris python3 -m venv /home/iris/env \
23+
&& sudo -Hu iris /bin/bash -c 'source /home/iris/env/bin/activate && python3 -m pip install -U pip wheel && cd /home/iris/source && pip install .'
24+
25+
COPY . /home/iris
26+
COPY ops/config/systemd /etc/systemd/system
27+
COPY ops/daemons /home/iris/daemons
28+
COPY ops/daemons/uwsgi-docker.yaml /home/iris/daemons/uwsgi.yaml
29+
COPY db /home/iris/db
30+
COPY configs /home/iris/config
31+
COPY healthcheck /tmp/status
32+
COPY ops/entrypoint.py /home/iris/entrypoint.py
33+
34+
RUN chown -R iris:iris /home/iris/
35+
36+
EXPOSE 16649
37+
38+
CMD ["sudo", "-EHu", "iris", "bash", "-c", "source /home/iris/env/bin/activate && python -u /home/iris/entrypoint.py"]

configs/config.dev.yaml

+3-2
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@ db: &db
1414
user: root
1515
password: ""
1616
host: 127.0.0.1
17+
port: 3306
1718
database: iris
1819
charset: utf8
19-
str: "%(scheme)s://%(user)s:%(password)s@%(host)s/%(database)s?charset=%(charset)s"
20+
str: "%(scheme)s://%(user)s:%(password)s@%(host)s:%(port)s/%(database)s?charset=%(charset)s"
2021
query_limit: 500
2122
kwargs:
2223
pool_recycle: 3600
@@ -35,7 +36,7 @@ db: &db
3536
# host: 127.0.0.1
3637
# database: iris
3738
# charset: utf8
38-
# str: "%(scheme)s://%(user)s:%(password)s@%(host)s/%(database)s?charset=%(charset)s"
39+
# str: "%(scheme)s://%(user)s:%(password)s@%(host)s:%(port)s/%(database)s?charset=%(charset)s"
3940
# kwargs:
4041
# pool_recycle: 3600
4142
# echo: False

docker-compose.yml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
version: '3'
2+
3+
services:
4+
iris-web:
5+
build: .
6+
ports:
7+
- "16649:16649"
8+
environment:
9+
- DOCKER_DB_BOOTSTRAP=1
10+
volumes:
11+
- ./configs/config.dev.yaml:/home/iris/config/config.yaml
12+
13+
iris-mysql:
14+
image: mysql:5.5
15+
environment:
16+
- MYSQL_ROOT_PASSWORD=1234

healthcheck

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
GOOD

ops/entrypoint.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def main():
9898
os.execv('/usr/bin/uwsgi',
9999
# first array element is ARGV0, since python 3.6 it cannot be empty, using space
100100
# https://bugs.python.org/issue28732
101-
[' ', '--yaml', os.environ.get('UWSGI_CONFIG', '/home/iris/daemons/uwsgi.yaml:prod')])
101+
['/usr/bin/uwsgi', '--yaml', '/home/iris/daemons/uwsgi.yaml:prod'])
102102

103103

104104
if __name__ == '__main__':

setup.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
'twilio==6.25.0',
3434
'google-api-python-client==1.4.2',
3535
'oauth2client==1.4.12',
36-
'slackclient==0.16',
36+
'slackclient',
3737
'PyYAML',
3838
'greenlet==0.4.16',
3939
'gevent==1.5.0',
@@ -49,15 +49,16 @@
4949
'msgpack==1.0.0',
5050
'cssmin',
5151
'beaker',
52-
'cryptography==2.3',
52+
'cryptography==3.2',
5353
'webassets',
5454
'python-ldap==3.1.0',
5555
'exchangelib==2.2.0',
5656
'setproctitle',
5757
'pyfcm==1.4.3',
58-
'oncallclient==1.0.0',
59-
'idna==2.7',
60-
'pyqrcode==1.2.1'
58+
'oncallclient==1.1.0',
59+
'idna==3.0',
60+
'pyqrcode==1.2.1',
61+
'plivo==4.18.1'
6162
],
6263
extras_require={
6364
'kazoo': ['kazoo==2.6.1'],

0 commit comments

Comments
 (0)