The aim of this repository is to set up a MariaDB database on cPouta using Terraform.
Note: The default variables will need to be modified or overridden using the -var flags
We need to install some tools before we start
Follow the instructions from the CSC documentation to install the OpenStack command line tools. Ensure you download the OpenStack RC file as described here and execute the following command to add the environment variables
source <project_name_here>-openrc.shYou will be prompted to enter your CSC password.
To verify that the setup worked run
openstack flavor listwhich will list all the available flavors as seen here.
Install Terraform suitable to the operating system on your local device.
There are three different stacks that can be deployed
- networking : The networking configuration that will be common. Needs to be run once
- cloud-volume: Creating a new persistent data volume
- server: Creating a server instance for Neo4J
When deploying for the first time you will need to first create the floating IP address, the security group (and its rules) once.
First create a ssh keypair:
ssh-keygen -t rsa cloud.keyThen create the networking stack using the following commands:
cd networking
terraform init
terraform apply --var 'ssh_key_file=../cloud.key'Note the floating ip address manually or by using terraform output -json > ./networking.json.
Next, create the cloud-volume stack by executing the following commands from the root directory to create 1600GB storage:
cd storage
terraform init
terraform apply --var 'storage_size=1638400'This will create a default persistent data volume. Save the name of the volume_id for the next steps either manually or by using terraform output -json > ./storage.json
Next, create the server stack by executing the following commands from the root directory:
cd server
terraform init
terraform apply This will ask the values the volume-id, floating-ip and other variables from the previous stacks.
Use host -a <floating-ip-address> to find the DNS name of the IP. Use this as the host to connect to MariaDB from any SQL client like DBeaver.