Commit 2925d012 authored by John Hackett's avatar John Hackett

Try apt-cache-ng as a means of speeding up converge times

parent ac7818d0
destroy:
terraform destroy -force
up: build
build:
terraform apply -auto-approve
rebuild: destroy build
apt-cache:
cat dockerfiles/apt-cacher-ng | docker build -t apt-cacher-ng -
docker kill apt-cacher-ng || true
docker rm apt-cacher-ng || true
docker run -d -p 3142:3142 --name apt-cacher-ng apt-cacher-ng
.PHONY: apt-cache build
\ No newline at end of file
#
# Build: docker build -t apt-cacher .
# Run: docker run -d -p 3142:3142 --name apt-cacher-run apt-cacher
#
# and then you can run containers with:
# docker run -t -i --rm -e http_proxy http://dockerhost:3142/ debian bash
#
# Here, `dockerhost` is the IP address or FQDN of a host running the Docker daemon
# which acts as an APT proxy server.
FROM debian
VOLUME ["/var/cache/apt-cacher-ng"]
RUN apt-get update && apt-get install -y apt-cacher-ng
EXPOSE 3142
CMD chmod 777 /var/cache/apt-cacher-ng && /etc/init.d/apt-cacher-ng start && tail -f /var/log/apt-cacher-ng/*
Acquire::http { Proxy "http://192.168.0.76:3142"; };
ssh_public_key = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCltYpJjBXD99GIoM7fukdMdi5OXAdf32M4xNrg9kQwygOKV7CMAyoZgMm+Y7Y2wvderLoGx0Nd3cjXNhBJMj+SuSoL36c3/VyoICOATR0IWaavpmUWxhFa+fQEQTMaUTA4ngtVUlEoZyY+9NwK+zHy7cFBVw4zDl20aLswFqpCms9kAxl9HVCOI/j1wYP0m/vHEjf/s42KvX9EVbRUZ+ZwYnNxAjVx/XxecF4tTSfZk7Sw4D9stBHqSBxoKWCpIQwtSgz6AzvnS0eDtf3/75NDOhbCU6JEa9OTFcTa6GeiZzzAK3NxqOq62DxSpXZaQT0D501+AySCjxxUBZ3ZDyL1kcThdtMNRUtZKlniVBQOmqC7aZpt6x31GJmTeA5y7cufwihC88ZEockN4y5N8LDxxeMBB9w2TtU8dfTFab54bxJZj1+3jigBzp5IUJXgk2iIliV8DB9t6jUPEkS+lXREcHeaBpv0rKH/N5lhJh5V+wWgKhee7vU74XwnJW3XlYeu7+r6pHeCBUuWGPE6ohZVx3BNF2FIXp5S/wJFwsHHACffQcNLq7iMmxt2q7VKaz1V9KnW8vmeYe540YmDbDrQQwAeo4N+2VfMrBk0lOx3zoYLcaizAx/ubd64BUdj5J0cdVKCR8hrFGe8tjBIvDQg/BT0zb5pZV73V0YSiLKvyQ=="
main_nic = "wlp58s0"
\ No newline at end of file
provider "lxd" {
provider "lxd" {}
}
variable "ssh_public_key" {}
variable "main_nic" {}
resource "lxd_container" "opennebula" {
name = "opennebula"
image = "images:debian/stretch"
device {
name = "vol1"
type = "disk"
properties {
path = "/"
pool = "${lxd_storage_pool.opennebula.name}"
}
}
profiles = ["${lxd_profile.opennebula.name}"]
provisioner "local-exec" {
command = "lxc exec ${lxd_container.opennebula.name} -- apt-get -y install gnupg python avahi-daemon openssh-server && lxc exec ${lxd_container.opennebula.name} -- systemctl start sshd && lxc exec ${lxd_container.opennebula.name} -- systemctl start avahi-daemon"
name = "opennebula"
image = "images:debian/stretch"
device {
name = "vol1"
type = "disk"
properties {
path = "/"
pool = "${lxd_storage_pool.opennebula.name}"
}
provisioner "local-exec" {
command = "lxc exec ${lxd_container.opennebula.name} -- bash -c 'mkdir -p /root/.ssh/ && echo ${var.ssh_public_key} > /root/.ssh/authorized_keys && chmod 600 /root/.ssh/authorized_keys && chmod 700 /root/.ssh'"
}
provisioner "local-exec" {
command = "export ANSIBLE_HOST_KEY_CHECKING=False && ansible-playbook -i ${lxd_container.opennebula.name}.local, playbook.yml -u root"
}
}
}
profiles = ["${lxd_profile.opennebula.name}"]
provisioner "local-exec" {
command = "lxc exec ${lxd_container.opennebula.name} -- bash -c 'mkdir -p /root/.ssh/ && echo ${var.ssh_public_key} > /root/.ssh/authorized_keys && chmod 600 /root/.ssh/authorized_keys && chmod 700 /root/.ssh'"
}
provisioner "local-exec" {
command = "lxc exec ${lxd_container.opennebula.name} -- apt-get -y install openssh-server avahi-daemon && lxc exec ${lxd_container.opennebula.name} -- systemctl start sshd"
}
provisioner "local-exec" {
command = "cat files/apt-proxy | lxc exec ${lxd_container.opennebula.name} -- tee /etc/apt/apt.conf.d/01proxy"
}
provisioner "local-exec" {
command = "lxc exec ${lxd_container.opennebula.name} -- apt-get -y install gnupg python avahi-daemon openssh-server && lxc exec ${lxd_container.opennebula.name} -- systemctl start sshd && lxc exec ${lxd_container.opennebula.name} -- systemctl start avahi-daemon"
}
provisioner "local-exec" {
command = "export ANSIBLE_HOST_KEY_CHECKING=False && ansible-playbook -i ${lxd_container.opennebula.name}.local, playbook.yml -u root"
}
}
resource "lxd_profile" "opennebula" {
name = "opennebula"
......@@ -43,11 +56,12 @@ resource "lxd_profile" "opennebula" {
}
resource "lxd_storage_pool" "opennebula" {
name = "%s"
driver = "dir"
config {
source = "/var/lib/lxd/storage-pools/opennebula"
}
name = "%s"
driver = "dir"
config {
source = "/var/lib/lxd/storage-pools/opennebula"
}
}
resource "lxd_network" "opennebula" {
......@@ -56,6 +70,5 @@ resource "lxd_network" "opennebula" {
config {
ipv4.address = "10.0.25.1/24"
ipv4.nat = "true"
bridge.driver = "openvswitch"
}
}
variable "ssh_public_key" {
default = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCltYpJjBXD99GIoM7fukdMdi5OXAdf32M4xNrg9kQwygOKV7CMAyoZgMm+Y7Y2wvderLoGx0Nd3cjXNhBJMj+SuSoL36c3/VyoICOATR0IWaavpmUWxhFa+fQEQTMaUTA4ngtVUlEoZyY+9NwK+zHy7cFBVw4zDl20aLswFqpCms9kAxl9HVCOI/j1wYP0m/vHEjf/s42KvX9EVbRUZ+ZwYnNxAjVx/XxecF4tTSfZk7Sw4D9stBHqSBxoKWCpIQwtSgz6AzvnS0eDtf3/75NDOhbCU6JEa9OTFcTa6GeiZzzAK3NxqOq62DxSpXZaQT0D501+AySCjxxUBZ3ZDyL1kcThdtMNRUtZKlniVBQOmqC7aZpt6x31GJmTeA5y7cufwihC88ZEockN4y5N8LDxxeMBB9w2TtU8dfTFab54bxJZj1+3jigBzp5IUJXgk2iIliV8DB9t6jUPEkS+lXREcHeaBpv0rKH/N5lhJh5V+wWgKhee7vU74XwnJW3XlYeu7+r6pHeCBUuWGPE6ohZVx3BNF2FIXp5S/wJFwsHHACffQcNLq7iMmxt2q7VKaz1V9KnW8vmeYe540YmDbDrQQwAeo4N+2VfMrBk0lOx3zoYLcaizAx/ubd64BUdj5J0cdVKCR8hrFGe8tjBIvDQg/BT0zb5pZV73V0YSiLKvyQ=="
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment