Deploy OpenStack on a single Ubuntu16.04 server using conjure-up

I'm sure that you heard a lot about the greatness of Canonical's conjure-up tool and how easy it is to deploy cloud platforms e.g. Kubernete, OpenStack etc... According to the conjure-up and Ubuntu websites, it's straightforward to have those big stack installed:

[0] https://conjure-up.io/
[1] https://www.ubuntu.com/download/cloud/try-openstack

$ sudo snap install conjure-up --classic
$ conjure-up

That's all they says. But, seriously, when I tried to deploy the Openstack NovaLXD (deploy OpenStack's components into LXD containers) using conjure-up in Ubuntu 16.04, it's pain in the ass. I spent almost 3 days to make it work. Let me explain what happened:

In Ubuntu 16.04, you can only use conjure-up installed through snappy not through apt:

$ sudo snap install conjure-up

That's not much of a deal as you can see. The problem is that conjure-up cannot communicate with the default LXD (network bridge interfaces, storage pools) shipped with Ubuntu 16.04. I felt super confusing because I already created the network bridges and all the zfs storage pool for LXD but when I ran conjure-up it just said that there's nothing. Damn! Then by looking at the conjure-up's log file ($HOME/.cache/conjure-up/conjure-up.log), I saw that the python function of conjure-up was having problem calling the LXD api or something and I guessed that there was a version's compatibility issue between conjure-up and LXD. So here is what I did to fix it:

1. Re-installed Ubuntu 16.04 to have a clean environment

2. Instead of using the default LXD, I added the LXD's stable PPA and upgraded it (important):

$ sudo apt-add-repository ppa:ubuntu-lxc/stable
$ sudo apt update
$ sudo apt dist-upgrade
$ sudo apt install lxd zfsutils-linux

3. Configure LXD (important):

$ sudo lxd init

Just answer the questions using the default values except for the IPv6's one. Then you will have a bridge network interface (e.g. lxdbr0: 10.x.x.x) and a zfspool.

4. Disable IPv6 on all the network interfaces:

$ sudo sysctl -w net.ipv6.conf.lxdbr0.disable_ipv6=1
$ sudo sysctl -w net.ipv6.conf.enp2s0.disable_ipv6=1

Note: change lxdbr0 and enp2s0 to your correct network interface names

5. Install conjure-up using snappy:

$ sudo snap install conjure-up

6. Then you will be able to deploy OpenStack NovaLX using conjure-up:

$ conjure-up

7. Create a NAT on the server to access to the OpenStack Dashboard service which running on the LXD's private network (10.x.x.x)

$ sudo iptables -t nat -A PREROUTING -p tcp -d <ip of the host server> --dport 443 -j DNAT --to-destination <internal ip of the openstack dashboard service, usually 10.x.x.x>:443

8. Enjoy