Skip to content
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

rebasing container image to ubuntu:20.04 #649

Merged
merged 2 commits into from
Nov 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ops/daemons/uwsgi-docker.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
prod:
plugins: python,logfile,gevent_python
plugins: python3,logfile,gevent_python3
chdir: /home/iris/source/src
socket: /home/iris/var/run/uwsgi.sock
chmod-socket: 666
Expand All @@ -8,7 +8,7 @@ prod:
# uid: 1000
# gid: 1000
workers: 12
gevent: 100
#gevent: 100 # workers die, if specified with gevent_python3 (why?)
lazy-apps: true
master-fifo: /home/iris/var/run/uwsgi_master_fifo
touch-reload: /home/iris/var/run/uwsgi_touch_reload
Expand Down
4 changes: 3 additions & 1 deletion ops/entrypoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,9 @@ def main():
initialize_mysql_schema(mysql_config)

os.execv('/usr/bin/uwsgi',
['', '--yaml', os.environ.get('UWSGI_CONFIG', '/home/iris/daemons/uwsgi.yaml:prod')])
# first array element is ARGV0, since python 3.6 it cannot be empty, using space
# https://bugs.python.org/issue28732
[' ', '--yaml', os.environ.get('UWSGI_CONFIG', '/home/iris/daemons/uwsgi.yaml:prod')])


if __name__ == '__main__':
Expand Down
10 changes: 10 additions & 0 deletions ops/packer/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.PHONY: all version docker

all: docker

version:
mkdir -p output
python gen_packer_cfg.py ./iris.yaml | tail -n +2 > ./output/iris.json

docker: version
packer build -only=docker ./output/iris.json
5 changes: 5 additions & 0 deletions ops/packer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ Build Docker image:
packer build -only=docker ./output/iris.json
```

or use

```bash
make docker
```

Usage
-----
Expand Down
12 changes: 9 additions & 3 deletions ops/packer/iris.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,10 @@ builders:
version: '{{ user `app_version` }}'

- type: "docker"
image: "ubuntu:16.04"
image: "ubuntu:20.04"
changes:
- 'EXPOSE 16649'
- "ENTRYPOINT []"
- 'CMD ["sudo", "-EHu", "iris", "bash", "-c", "source /home/iris/env/bin/activate && python /home/iris/entrypoint.py"]'
commit: True

Expand All @@ -64,6 +65,10 @@ provisioners:
- type: "file"
source: "../../setup.py"
destination: "/tmp/repo/setup.py"

- type: "file"
source: "../../README.md"
destination: "/tmp/repo/README.md"

- type: "file"
source: "../../db"
Expand All @@ -80,7 +85,7 @@ provisioners:
- type: "shell"
only: ["docker"]
inline:
- "apt-get update && apt-get -y install sudo"
- "apt update && apt -y install sudo"

- type: "shell"
only: ["amazon-ebs"]
Expand All @@ -89,7 +94,8 @@ provisioners:

- type: "shell"
inline:
- 'sudo apt-get -y install curl python-pip uwsgi unzip virtualenv sudo python-dev libyaml-dev libsasl2-dev libldap2-dev nginx uwsgi-plugin-python uwsgi-plugin-gevent-python mysql-client && sudo rm -rf /var/cache/apt/archives/*'
# for ubuntu:20.04, Python 3.8 is used
- 'DEBIAN_FRONTEND=noninteractive sudo -E apt -y install python3 python3-pip python3-virtualenv && DEBIAN_FRONTEND=noninteractive sudo -E apt -y install libldap2-dev libsasl2-dev && DEBIAN_FRONTEND=noninteractive sudo -E apt -y install nginx uwsgi uwsgi-plugin-python3 uwsgi-plugin-gevent-python3 && DEBIAN_FRONTEND=noninteractive sudo -E apt -y install mysql-client && sudo rm -rf /var/cache/apt/archives/*'
- sudo useradd -m -s /bin/bash iris
- sudo chown -R iris:iris /home/iris /var/log/nginx /var/lib/nginx
- sudo -Hu iris mkdir -p /home/iris/var/log/uwsgi /home/iris/var/log/nginx /home/iris/var/run
Expand Down