- Vagrant
- Virtualbox
For starting all you need is vagrant and virtualbox, once you have them you can start by installing the virtualbox guest additions plugin by vagrant and getting the VM up.
Run the following command for installing the plugin:
vagrant plugin install vagrant-vbguestThis is required because the virtualbox guest additions in the VM might be a different version from the host version of VirtualBox and this causes problems while sharing folders. Once the plugin is installed, you can start the VM:
vagrant upThis might take a while since it will be downloading the debian box, then it will install all of the required tools and docker images to run ghost inside docker in the VM.
After all of the provisioning finishes, you can open the Ghost platform on your host browser: https://localhost:8080 And for the admin panel: https://localhost:8080/ghost
The project uses vagrant to spin up a debian 10 VM and then uses the shell and ansible_local vagrant provisioners.
The shell is used to execute the bootstrap.sh which will install ansible in the VM, we do this so we can use later the ansible_local provisioner to install and configure docker and start our docker compose project.
- Vagrantfile (This should be self explanotory, we configure a VM with 2 GB of RAM, share this folder to the VM at
/vagrant_data, forward the port from the host to the guest443 -> 443, run theshellandansible_localprovisioners) - playbook (This is the main ansible playbook which will be run inside of the VM, it uses our custom roles to configure the VM)
- ansible.cfg (This is the configuration file which will be used by ansible, the only thing that we define here is which python interpreter ansible should use, this is required since some of the tasks in the roles use
pipto install modules) - roles (Here we define our custom roles,
debian-basefor updating the system and installing some required packages,debian-dockerfor installing docker and docker-compose in debian,docker-ghostfor installing the prerequisites of the ghost package and running it usingdocker-compose) - docker (Here we define the ghost docker configuration files, we have the
docker-compose.ymlfile which will start all of the required containers and will link them. We have our own custom nginx Dockerfile which addscertsand the ghost configuration)