GithubHelp home page GithubHelp logo

simhaonline / lxcdeploy Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ethanlonge/lxcdeploy

0.0 0.0 0.0 40 KB

Custom Scripts for the deployment of LXD/LXC containers

License: GNU General Public License v3.0

Python 55.17% Shell 44.83%

lxcdeploy's Introduction

LXCDeploy

This is a simple script that allows the easy creation of LXC/LXD containers for immediate use. This includes:

  • Assignment of public IPv6
  • Assignment of Hostnames:
    • Hybrid Hostname (IPv4 of host, IPv6 of container) for Apache2 ProxyPass (DIY)
    • IPv6 Only Hostname
  • Assignment of random root password
  • Enabling of SSH for remote access

It is designed with the following in mind:

  • You are (or will be) using LXC/LXD for containers
  • You are using Netplan to manage your public IPv6 addresses and have set it up for static IPv6 addresses
  • You are (or will be) using BIND for DNS records for hostnames for the container (There is an example config for BIND further down)
  • Your LXC network bridge is named lxcbr0

Table of Contents

Install

Requirements

sudo apt install python3-pip iptables-persistent
sudo pip3 install setuptools wheel
sudo pip3 install -U pyyaml pylxd

BIND Config

If you do not have an existing BIND config, it is recommend you do the following: Replace server-name, public-ipv4 and public-ipv6 with the correlating information

Bash:

    apt install bind9
    mkdir /etc/bind/zones
    cp /etc/bind/db.local /etc/bind/zones/db.server-name

Edit /etc/bind/named.conf.options:

    listen-on-v6 { public-ipv6; };
    listen-on { public-ipv4; }; 
    allow-transfer { none; };
    forwarders { 8.8.8.8; 8.8.4.4 };

Edit /etc/bind/named.conf.local:

    zone "server-name" {
        type master;
        file "/etc/bind/zones/db.server-name";
    };

Edit /etc/bind/zones/db.server-name:

    ;
    ; BIND data file for server-name
    ;
    $TTL    604800
    @       IN      SOA     ns1.server-name. admin.server-name. (
                                  3         ; Serial
                             604800         ; Refresh
                              86400         ; Retry
                            2419200         ; Expire
                             604800 )       ; Negative Cache TTL
    ;
                              IN      NS      ns1.server-name.
    ns1.server-name.                      IN      A       public-ipv4
    ns1.server-name.                      IN      AAAA    public-ipv6
    server-name.                          IN      A       public-ipv4
    server-name.                          IN      AAAA    public-ipv6
    txtrec.server-name.      300     IN      TXT   TestConf ; Test Configuration

Bash:

    systemctl restart bind9
    dig txtrec.server-name @public-ipv4 txt +short ; Should output "TestConf" if BIND is working

Your DNS Provider:

    A ns1.server-name public-ipv4
    NS server-name ns1.server-name

Bash:

    dig txtrec.server-name txt +short ; Should output "TestConf" if your configuration is working

Configuration

To configure the script, rename sampleconfig.yaml to config.yaml and replace the values.

Container_defaults

image

The default image for the creation of LXD/LXC containers (default is "ubuntu:18.04")
Example: "ubuntu:18.04"

Networking

fqdn

Your fully qualified domain name (for DNS records)
Example: "example.com"

ipv4

Your public IPv4 address of your server
Example: "93.184.216.34"

ipv6

Your public IPv6 address of your server
Example: "2001:0DB8:DEAD:BEEF:1337:3114:ab13:3152"

ipv6_prefix

Your IPv6 /64 prefix with trailing colon
Example: "2001:0DB8:DEAD:BEEF:"

ipv6_container_prefix

A prefix for between your public prefix and container number
Example: "1337:0420:0069:" in
"2001:0DB8:DEAD:BEEF:1337:0420:0069:0001"

DNS

ttl

The TTL for your DNS records (default is 3600)
Example: 3600

zone_db

The location of your BIND zone
Example: "/etc/bind/zones/db.example.com"

lxcdeploy's People

Contributors

ethanlonge avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.