Feature: Updated the frank dockerfile to properly install python poetry
Feature: Updated the frank playbook to allow user to be changed from pi Chore: Refactored the various env files to use single file and multiple var files.
This commit is contained in:
parent
ecea277e46
commit
93b1b8840d
@ -1,7 +1,7 @@
|
|||||||
FROM python:latest
|
FROM python:latest
|
||||||
|
|
||||||
# Install Poetry
|
# Install Poetry
|
||||||
RUN curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | POETRY_HOME=/opt/poetry python && \
|
RUN curl -sSL https://install.python-poetry.org | POETRY_HOME=/opt/poetry python - && \
|
||||||
cd /usr/local/bin && \
|
cd /usr/local/bin && \
|
||||||
ln -s /opt/poetry/bin/poetry && \
|
ln -s /opt/poetry/bin/poetry && \
|
||||||
poetry config virtualenvs.create false && \
|
poetry config virtualenvs.create false && \
|
||||||
|
@ -2,17 +2,17 @@ HOST=0.0.0.0
|
|||||||
PORT=80
|
PORT=80
|
||||||
LOG_LEVEL=WARN
|
LOG_LEVEL=WARN
|
||||||
DEBUG=false
|
DEBUG=false
|
||||||
SQLALCHEMY_DATABASE_URI=postgresql://postgres:123456@db:5432/petty
|
SQLALCHEMY_DATABASE_URI=postgresql://postgres:123456@db:5432/petty{{ name }}
|
||||||
MODULE_NAME=barker.main
|
MODULE_NAME=barker.main
|
||||||
PROJECT_NAME=barker
|
PROJECT_NAME=barker
|
||||||
|
MAX_WORKERS=4
|
||||||
REDIS_HOST=redis
|
REDIS_HOST=redis
|
||||||
REDIS_PORT=6379
|
REDIS_PORT=6379
|
||||||
SECRET_KEY=611f9393e58f85521d16d9497bfd847ced70f2b99e12a9c6af40b7bd05cc7b1d
|
SECRET_KEY={{ secret_key }}
|
||||||
MIDDLEWARE_SECRET_KEY=c4afceca1a
|
MIDDLEWARE_SECRET_KEY={{ middleware_key }}
|
||||||
ALGORITHM=HS256
|
ALGORITHM=HS256
|
||||||
JWT_TOKEN_EXPIRE_MINUTES=30
|
JWT_TOKEN_EXPIRE_MINUTES=30
|
||||||
NEW_DAY_OFFSET_MINUTES=420
|
NEW_DAY_OFFSET_MINUTES=420
|
||||||
TIMEZONE_OFFSET_MINUTES=330
|
TIMEZONE_OFFSET_MINUTES=330
|
||||||
ALEMBIC_LOG_LEVEL=INFO
|
ALEMBIC_LOG_LEVEL=INFO
|
||||||
ALEMBIC_SQLALCHEMY_LOG_LEVEL=WARN
|
ALEMBIC_SQLALCHEMY_LOG_LEVEL=WARN
|
||||||
SQLALCHEMY_WARN_20=true
|
|
||||||
|
@ -1,18 +0,0 @@
|
|||||||
HOST=0.0.0.0
|
|
||||||
PORT=80
|
|
||||||
LOG_LEVEL=WARN
|
|
||||||
DEBUG=false
|
|
||||||
SQLALCHEMY_DATABASE_URI=postgresql://postgres:123456@db:5432/pettychd
|
|
||||||
MODULE_NAME=barker.main
|
|
||||||
PROJECT_NAME=barker
|
|
||||||
MAX_WORKERS=4
|
|
||||||
REDIS_HOST=redis
|
|
||||||
REDIS_PORT=6379
|
|
||||||
SECRET_KEY=d9e4facec94d7e0bf3d63ca03b1d78d834b158627b6593274f7fe27f6aed6db4
|
|
||||||
MIDDLEWARE_SECRET_KEY=8d5f28b083
|
|
||||||
ALGORITHM=HS256
|
|
||||||
JWT_TOKEN_EXPIRE_MINUTES=30
|
|
||||||
NEW_DAY_OFFSET_MINUTES=420
|
|
||||||
TIMEZONE_OFFSET_MINUTES=330
|
|
||||||
ALEMBIC_LOG_LEVEL=INFO
|
|
||||||
ALEMBIC_SQLALCHEMY_LOG_LEVEL=WARN
|
|
@ -1,18 +0,0 @@
|
|||||||
HOST=0.0.0.0
|
|
||||||
PORT=80
|
|
||||||
LOG_LEVEL=WARN
|
|
||||||
DEBUG=false
|
|
||||||
SQLALCHEMY_DATABASE_URI=postgresql://postgres:123456@db:5432/pettymhl
|
|
||||||
MODULE_NAME=barker.main
|
|
||||||
PROJECT_NAME=barker
|
|
||||||
MAX_WORKERS=4
|
|
||||||
REDIS_HOST=redis
|
|
||||||
REDIS_PORT=6379
|
|
||||||
SECRET_KEY=8b7f704ad1bbee3caa683a57440a6a371937fe5f64a7712a6a15bf3165c3c598
|
|
||||||
MIDDLEWARE_SECRET_KEY=1aa5487223
|
|
||||||
ALGORITHM=HS256
|
|
||||||
JWT_TOKEN_EXPIRE_MINUTES=30
|
|
||||||
NEW_DAY_OFFSET_MINUTES=420
|
|
||||||
TIMEZONE_OFFSET_MINUTES=330
|
|
||||||
ALEMBIC_LOG_LEVEL=INFO
|
|
||||||
ALEMBIC_SQLALCHEMY_LOG_LEVEL=WARN
|
|
@ -1,18 +0,0 @@
|
|||||||
HOST=0.0.0.0
|
|
||||||
PORT=80
|
|
||||||
LOG_LEVEL=WARN
|
|
||||||
DEBUG=false
|
|
||||||
SQLALCHEMY_DATABASE_URI=postgresql://postgres:123456@db:5432/pettypkl
|
|
||||||
MODULE_NAME=barker.main
|
|
||||||
PROJECT_NAME=barker
|
|
||||||
MAX_WORKERS=4
|
|
||||||
REDIS_HOST=redis
|
|
||||||
REDIS_PORT=6379
|
|
||||||
SECRET_KEY=bd6e5dee0f3b8a6f0db50f7aa08e91d55b2ae5ab6df126defa37e80602481002
|
|
||||||
MIDDLEWARE_SECRET_KEY=1d34ef6597
|
|
||||||
ALGORITHM=HS256
|
|
||||||
JWT_TOKEN_EXPIRE_MINUTES=30
|
|
||||||
NEW_DAY_OFFSET_MINUTES=420
|
|
||||||
TIMEZONE_OFFSET_MINUTES=330
|
|
||||||
ALEMBIC_LOG_LEVEL=INFO
|
|
||||||
ALEMBIC_SQLALCHEMY_LOG_LEVEL=WARN
|
|
@ -1 +1 @@
|
|||||||
docker build --file /home/pi/dockerfile/app/frank.Dockerfile --tag frank:latest /home/pi/dockerfile/app
|
docker build --file /home/{{ user }}/dockerfile/app/frank.Dockerfile --tag frank:latest /home/{{ user }}/dockerfile/app
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
REDIS_HOST=localhost
|
REDIS_HOST=localhost
|
||||||
REDIS_PORT=6379
|
REDIS_PORT=6379
|
||||||
QUEUE_NAME=tanshu-home
|
QUEUE_NAME="{{ queue_name }}"
|
||||||
|
@ -1 +1 @@
|
|||||||
docker run --detach --name frank --env-file=/home/pi/frank.env --network=host --restart=no --device /dev/usb/lp0:/printer frank:latest
|
docker run --detach --name frank --env-file=/home/{{ user }}/frank.env --network=host --restart=no --device /dev/usb/lp0:/printer frank:latest
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
pkl ansible_host=beacon var_file=vars/pkl.yml
|
pkl ansible_host=beacon var_file=vars/pkl.yml
|
||||||
chd ansible_host=beacon var_file=vars/chd.yml
|
chd ansible_host=beacon var_file=vars/chd.yml
|
||||||
mhl ansible_host=beacon var_file=vars/mhl.yml
|
mhl ansible_host=beacon var_file=vars/mhl.yml
|
||||||
# hin ansible_host=beacon var_file=vars/hin.yml
|
hin ansible_host=beacon var_file=vars/hin.yml
|
||||||
|
|
||||||
[all:vars]
|
[all:vars]
|
||||||
ansible_python_interpreter=/usr/bin/python3
|
ansible_python_interpreter=/usr/bin/python3
|
||||||
|
@ -9,20 +9,20 @@
|
|||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
- name: Copy dockerfile
|
- name: Copy dockerfile
|
||||||
synchronize: src=app dest=/home/pi/dockerfile
|
synchronize: src=app dest="/home/{{ user }}/dockerfile"
|
||||||
|
|
||||||
- name: Build frank image
|
- name: Build frank image
|
||||||
docker_image:
|
docker_image:
|
||||||
name: frank:latest
|
name: frank:latest
|
||||||
build:
|
build:
|
||||||
path: /home/pi/dockerfile/app
|
path: "/home/{{ user }}/dockerfile/app"
|
||||||
dockerfile: /home/pi/dockerfile/app/frank.Dockerfile
|
dockerfile: "/home/{{ user }}/dockerfile/app/frank.Dockerfile"
|
||||||
pull: yes
|
pull: yes
|
||||||
state: present
|
state: present
|
||||||
source: build
|
source: build
|
||||||
|
|
||||||
- name: Check if frank .env file exists
|
- name: Check if frank .env file exists
|
||||||
stat: path="/home/pi/frank.env"
|
stat: path="/home/{{ user }}/frank.env"
|
||||||
register: status
|
register: status
|
||||||
|
|
||||||
- name: No need to upload the frank .env file
|
- name: No need to upload the frank .env file
|
||||||
@ -32,9 +32,9 @@
|
|||||||
when: status.stat.exists == false
|
when: status.stat.exists == false
|
||||||
template:
|
template:
|
||||||
src: files/frank.env
|
src: files/frank.env
|
||||||
dest: /home/pi/frank.env
|
dest: "/home/{{ user }}/frank.env"
|
||||||
group: pi
|
group: "{{ user }}"
|
||||||
owner: pi
|
owner: "{{ user }}"
|
||||||
mode: 0644
|
mode: 0644
|
||||||
|
|
||||||
- name: Create frank worker container
|
- name: Create frank worker container
|
||||||
@ -43,7 +43,7 @@
|
|||||||
image: frank:latest
|
image: frank:latest
|
||||||
state: started
|
state: started
|
||||||
restart_policy: "no"
|
restart_policy: "no"
|
||||||
env_file: "/home/pi/frank.env"
|
env_file: "/home/{{ user }}/frank.env"
|
||||||
network_mode: "host"
|
network_mode: "host"
|
||||||
devices:
|
devices:
|
||||||
- "{{ printer_port }}:/printer"
|
- "{{ printer_port }}:/printer"
|
||||||
@ -51,17 +51,17 @@
|
|||||||
- name: Copy docker build script
|
- name: Copy docker build script
|
||||||
template:
|
template:
|
||||||
src: files/build-frank.sh
|
src: files/build-frank.sh
|
||||||
dest: /home/pi/dockerfile/build-frank.sh
|
dest: "/home/{{ user }}/dockerfile/build-frank.sh"
|
||||||
group: pi
|
group: "{{ user }}"
|
||||||
owner: pi
|
owner: "{{ user }}"
|
||||||
mode: 0644
|
mode: 0644
|
||||||
|
|
||||||
- name: Copy docker run script
|
- name: Copy docker run script
|
||||||
template:
|
template:
|
||||||
src: files/frank.sh
|
src: files/frank.sh
|
||||||
dest: /home/pi/dockerfile/frank.sh
|
dest: "/home/{{ user }}/dockerfile/frank.sh"
|
||||||
group: pi
|
group: "{{ user }}"
|
||||||
owner: pi
|
owner: "{{ user }}"
|
||||||
mode: 0644
|
mode: 0644
|
||||||
|
|
||||||
- name: install frank systemd unit file
|
- name: install frank systemd unit file
|
||||||
|
@ -17,5 +17,5 @@
|
|||||||
|
|
||||||
- name: Upload the .env file
|
- name: Upload the .env file
|
||||||
template:
|
template:
|
||||||
src: "{{ env_file }}"
|
src: "files/.env"
|
||||||
dest: "/var/lib/{{ host_directory }}/.env"
|
dest: "/var/lib/{{ host_directory }}/.env"
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
---
|
---
|
||||||
|
name: chd
|
||||||
|
secret_key: d9e4facec94d7e0bf3d63ca03b1d78d834b158627b6593274f7fe27f6aed6db4
|
||||||
|
middleware_key: 8d5f28b083
|
||||||
|
|
||||||
http_host: "knox.greatbear.in"
|
http_host: "knox.greatbear.in"
|
||||||
http_conf: "knox.greatbear.in.conf"
|
http_conf: "knox.greatbear.in.conf"
|
||||||
host_port: "8337"
|
host_port: "8337"
|
||||||
host_directory: "barker-chd"
|
host_directory: "barker-{{ name }}"
|
||||||
env_file: "files/.env-chd"
|
|
||||||
|
@ -1,5 +1,11 @@
|
|||||||
---
|
---
|
||||||
|
name: xxx
|
||||||
|
# openssl rand -hex 32
|
||||||
|
secret_key: 0000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
# openssl rand -hex 5
|
||||||
|
middleware_key: 0000000000
|
||||||
|
|
||||||
http_host: "knox.hopsngrains.com"
|
http_host: "knox.hopsngrains.com"
|
||||||
http_conf: "knox.hopsngrains.com.conf"
|
http_conf: "knox.hopsngrains.com.conf"
|
||||||
host_port: "8338"
|
host_port: "8338"
|
||||||
host_directory: "barker"
|
host_directory: "barker-{{ name }}"
|
||||||
|
@ -1,2 +1,4 @@
|
|||||||
---
|
---
|
||||||
printer_port: "/dev/usb/lp0"
|
printer_port: "/dev/usb/lp0"
|
||||||
|
user: vari
|
||||||
|
queue_name: moz-main
|
||||||
|
9
docker/vars/hin.yml
Normal file
9
docker/vars/hin.yml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
---
|
||||||
|
name: hin
|
||||||
|
secret_key: 029858927beda45d76317729824ae500d0938f04d4ca955f3afa95061c9a9298
|
||||||
|
middleware_key: c4b0b98ff9
|
||||||
|
|
||||||
|
http_host: "knox.mozimo.in"
|
||||||
|
http_conf: "knox.mozimo.in.conf"
|
||||||
|
host_port: "8335"
|
||||||
|
host_directory: "barker-{{ name }}"
|
@ -1,6 +1,9 @@
|
|||||||
---
|
---
|
||||||
|
name: mhl
|
||||||
|
secret_key: 8b7f704ad1bbee3caa683a57440a6a371937fe5f64a7712a6a15bf3165c3c598
|
||||||
|
middleware_key: 1aa5487223
|
||||||
|
|
||||||
http_host: "knox.hngmohali.com"
|
http_host: "knox.hngmohali.com"
|
||||||
http_conf: "knox.hngmohali.com.conf"
|
http_conf: "knox.hngmohali.com.conf"
|
||||||
host_port: "8336"
|
host_port: "8336"
|
||||||
host_directory: "barker-mhl"
|
host_directory: "barker-{{ name }}"
|
||||||
env_file: "files/.env-mhl"
|
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
---
|
---
|
||||||
|
name: pkl
|
||||||
|
secret_key: bd6e5dee0f3b8a6f0db50f7aa08e91d55b2ae5ab6df126defa37e80602481002
|
||||||
|
middleware_key: 1d34ef6597
|
||||||
|
|
||||||
http_host: "knox.hopsngrains.com"
|
http_host: "knox.hopsngrains.com"
|
||||||
http_conf: "knox.hopsngrains.com.conf"
|
http_conf: "knox.hopsngrains.com.conf"
|
||||||
host_port: "8338"
|
host_port: "8338"
|
||||||
host_directory: "barker-pkl"
|
host_directory: "barker-{{ name }}"
|
||||||
env_file: "files/.env-pkl"
|
|
||||||
|
Loading…
Reference in New Issue
Block a user