fix
This commit is contained in:
parent
2970f41b5e
commit
3f2af3e0a4
@ -2,7 +2,7 @@ FROM nginx
|
||||
RUN apt-get update
|
||||
RUN apt-get install certbot --yes
|
||||
RUN apt-get install python3-certbot-nginx --yes
|
||||
RUN pip3 install requests
|
||||
RUN pip3 install requests minio
|
||||
COPY ./config /etc/nginx
|
||||
COPY run.py run.py
|
||||
CMD ["python3", "run.py"]
|
@ -1,5 +1,15 @@
|
||||
from requests import get
|
||||
from subprocess import call
|
||||
import os
|
||||
from minio import Minio
|
||||
|
||||
|
||||
minio_client = Minio(
|
||||
"minio.develop.sprinthub.ru:9000",
|
||||
access_key="serviceminioadmin",
|
||||
secret_key=os.getenv("MINIO_SECRET_KEY", "minioadmin"),
|
||||
secure=False
|
||||
)
|
||||
|
||||
|
||||
hosts = get('http://configurator/api/v1/fetch?project=certupdater&stage=development').json()['configs']['hosts']
|
||||
@ -27,6 +37,12 @@ for host in hosts:
|
||||
\}
|
||||
\}\n\n
|
||||
'''.format(host, host.split('.')[0])
|
||||
fullchain = minio_client.get_object("certupdater", f'certificates/{host}/fullchain.pem')
|
||||
privkey = minio_client.get_object("certupdater", f'certificates/{host}/privkey.pem')
|
||||
with open(f"/etc/nginx/{host}/fullchain.pem", 'wb') as fp:
|
||||
fp.write(fullchain.data)
|
||||
with open(f"/etc/nginx/{host}/privkey.pem", 'wb') as fp:
|
||||
fp.write(privkey.data)
|
||||
|
||||
with open('/etc/nginx/hosts.conf', 'w') as fp:
|
||||
fp.write(config)
|
||||
|
Loading…
Reference in New Issue
Block a user