mirror of
https://github.com/hyperknot/openfreemap.git
synced 2026-05-21 14:02:15 +00:00
work
This commit is contained in:
@@ -4,7 +4,7 @@ import click
|
|||||||
from fabric import Config, Connection
|
from fabric import Config, Connection
|
||||||
|
|
||||||
from ssh_lib.config import config
|
from ssh_lib.config import config
|
||||||
from ssh_lib.tasks_http_host import prepare_http_host, run_http_host_sync
|
from ssh_lib.tasks_http_host import prepare_http_host, run_http_host_sync, upload_config_and_certs
|
||||||
from ssh_lib.tasks_shared import prepare_shared
|
from ssh_lib.tasks_shared import prepare_shared
|
||||||
from ssh_lib.tasks_tile_gen import prepare_tile_gen
|
from ssh_lib.tasks_tile_gen import prepare_tile_gen
|
||||||
from ssh_lib.utils import (
|
from ssh_lib.utils import (
|
||||||
@@ -78,10 +78,10 @@ def http_host_autoupdate(hostname, user, port, noninteractive):
|
|||||||
|
|
||||||
# prepare_shared(c)
|
# prepare_shared(c)
|
||||||
prepare_http_host(c)
|
prepare_http_host(c)
|
||||||
#
|
|
||||||
# run_http_host_sync(c) # disable for first install if you don't want to wait
|
run_http_host_sync(c) # disable for first install if you don't want to wait
|
||||||
#
|
|
||||||
# put(c, config.local_modules_dir / 'http_host' / 'cron.d' / 'ofm_http_host', '/etc/cron.d/')
|
put(c, config.local_modules_dir / 'http_host' / 'cron.d' / 'ofm_http_host', '/etc/cron.d/')
|
||||||
|
|
||||||
|
|
||||||
@cli.command()
|
@cli.command()
|
||||||
|
|||||||
@@ -2,8 +2,6 @@ import json
|
|||||||
import subprocess
|
import subprocess
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
import json5
|
|
||||||
|
|
||||||
|
|
||||||
class Configuration:
|
class Configuration:
|
||||||
areas = ['planet', 'monaco']
|
areas = ['planet', 'monaco']
|
||||||
|
|||||||
@@ -53,6 +53,9 @@ def nginx(c):
|
|||||||
|
|
||||||
|
|
||||||
def certbot(c):
|
def certbot(c):
|
||||||
|
print('should use nginx acme')
|
||||||
|
return
|
||||||
|
|
||||||
apt_get_install(c, 'snapd')
|
apt_get_install(c, 'snapd')
|
||||||
|
|
||||||
# this is silly, but needs to be run twice
|
# this is silly, but needs to be run twice
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ def prepare_http_host(c):
|
|||||||
kernel_limits1m(c)
|
kernel_limits1m(c)
|
||||||
|
|
||||||
nginx(c)
|
nginx(c)
|
||||||
certbot(c)
|
# certbot(c)
|
||||||
|
|
||||||
c.sudo(f'rm -rf {config.http_host_dir}/logs')
|
c.sudo(f'rm -rf {config.http_host_dir}/logs')
|
||||||
c.sudo(f'mkdir -p {config.http_host_dir}/logs')
|
c.sudo(f'mkdir -p {config.http_host_dir}/logs')
|
||||||
@@ -72,11 +72,17 @@ def upload_config_and_certs(c):
|
|||||||
|
|
||||||
if domain_data['cert']['type'] == 'upload':
|
if domain_data['cert']['type'] == 'upload':
|
||||||
local_cert_path = Path(domain_data['cert']['cert_path'])
|
local_cert_path = Path(domain_data['cert']['cert_path'])
|
||||||
|
|
||||||
|
# handle relative paths - make them relative to config.local_config_dir
|
||||||
|
if not local_cert_path.is_absolute():
|
||||||
|
local_cert_path = Path(config.local_config_dir) / local_cert_path
|
||||||
|
|
||||||
cert_basename = local_cert_path.stem
|
cert_basename = local_cert_path.stem
|
||||||
local_key_path = local_cert_path.parent / f'{cert_basename}.key'
|
local_key_path = local_cert_path.parent / f'{cert_basename}.key'
|
||||||
if not local_cert_path.is_file() or local_key_path.is_file():
|
|
||||||
|
if not local_cert_path.is_file() or not local_key_path.is_file():
|
||||||
print(
|
print(
|
||||||
f'cert or key file for {domain_data["domain"]} is not found. Make sure these files exists: {local_cert_path} {local_key_path}'
|
f'cert or key file for {domain_data["domain"]} is not found.\nMake sure these files exists:\n{local_cert_path}\n{local_key_path}\n------'
|
||||||
)
|
)
|
||||||
|
|
||||||
remote_cert_path = f'/data/nginx/certs/ofm-{domain_data["slug"]}.cert'
|
remote_cert_path = f'/data/nginx/certs/ofm-{domain_data["slug"]}.cert'
|
||||||
@@ -103,8 +109,8 @@ def upload_http_host_files(c):
|
|||||||
|
|
||||||
put_dir(
|
put_dir(
|
||||||
c,
|
c,
|
||||||
config.local_modules_dir / 'http_host' / 'http_host_lib' / 'nginx_confs',
|
config.local_modules_dir / 'http_host' / 'http_host_lib' / 'nginx_templates',
|
||||||
f'{config.http_host_bin}/http_host_lib/nginx_confs',
|
f'{config.http_host_bin}/http_host_lib/nginx_templates',
|
||||||
)
|
)
|
||||||
|
|
||||||
c.sudo('chown -R ofm:ofm /data/ofm/http_host')
|
c.sudo('chown -R ofm:ofm /data/ofm/http_host')
|
||||||
|
|||||||
Reference in New Issue
Block a user