remove ephemeral layer
This commit is contained in:
parent
5facbb1b35
commit
b02d70df38
@ -215,11 +215,15 @@ class VMMgr:
|
||||
ip = tools.get_unused_ip()
|
||||
tools.update_hosts_lease(ip, app)
|
||||
tools.set_container_ip(pid, ip)
|
||||
# Remove ephemeral layer data
|
||||
tools.remove_ephemeral_layer(app)
|
||||
|
||||
def unregister_container(self):
|
||||
# Unset IP of a container based on values given via lxc.hook.post-stop hook
|
||||
app = os.environ['LXC_NAME']
|
||||
tools.update_hosts_lease(None, app)
|
||||
# Remove ephemeral layer data
|
||||
tools.remove_ephemeral_layer(app)
|
||||
|
||||
def register_proxy(self, app, reload_nginx=True):
|
||||
# Rebuild nginx configuration using IP of referenced app container and reload nginx
|
||||
|
@ -5,6 +5,7 @@ import dns.exception
|
||||
import dns.resolver
|
||||
import os
|
||||
import requests
|
||||
import shutil
|
||||
import socket
|
||||
import ssl
|
||||
import subprocess
|
||||
@ -153,3 +154,9 @@ def set_container_ip(pid, ip):
|
||||
# Set IP in container based on PID given via lxc.hook.start-host hook
|
||||
cmd = 'ip addr add {}/16 broadcast 172.17.255.255 dev eth0 && ip route add default via 172.17.0.1'.format(ip)
|
||||
subprocess.run(['nsenter', '-a', '-t', pid, '--', '/bin/sh', '-c', cmd])
|
||||
|
||||
def remove_ephemeral_layer(app):
|
||||
layer = os.path.join('/var/lib/lxc', app, 'delta0')
|
||||
if os.path.exists(layer):
|
||||
for item in os.scandir(layer):
|
||||
shutil.rmtree(item.path) if item.is_dir() else os.unlink(item.path)
|
||||
|
14
setup-all.sh
Executable file
14
setup-all.sh
Executable file
@ -0,0 +1,14 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
SOURCE_DIR=$(realpath $(dirname "${0}"))
|
||||
|
||||
# Setup components
|
||||
${SOURCE_DIR}/activemq/setup.sh
|
||||
${SOURCE_DIR}/ckan-datapusher/setup.sh
|
||||
${SOURCE_DIR}/postgres/setup.sh
|
||||
${SOURCE_DIR}/redis/setup.sh
|
||||
${SOURCE_DIR}/solr/setup.sh
|
||||
|
||||
# Setup applications
|
||||
${SOURCE_DIR}/ckan
|
Loading…
Reference in New Issue
Block a user