Terraform project provision the Cloud Resources needed for developing an Application. Its main purpuse is to provide the Infrastructure that follows the Continuous Integration and Continuos Delivery(CI/CD) software development cycle.
This work was presented during the OpenStack Summit in Barcelona in 2016.
These are the requirements and steps needed for deploying this solution into production.
- Install Terraform
- Customize according to your OpenStack Provider
Terraform OpenStack provider needs environment variables to be set before you can run the scripts. In general, you can simply export OS environment variables like the following:
export OS_TENANT_NAME=osic-engineering
export OS_AUTH_URL=https://cloud1.osic.org:5000/v2.0
export OS_DOMAIN_NAME=Default
export OS_REGION_NAME=RegionOne
export OS_PASSWORD=secret
export OS_USERNAME=demo
Those values depend on the OpenStack Cloud provider.
$ git clone https://github.com/electrocucaracha/terraform-cicd.git
$ cd terraform-cicd
$ terraform apply
...
Apply complete! Resources: 13 added, 0 changed, 0 destroyed.
...
Outputs:
gerrit = http://10.0.0.2
jenkins = http://10.0.0.3
redmine = http://10.0.0.4
First you need to get consumer key/secret from Redmine OAuth Provider Plugin.
- Log into your Redmine account.
- Access to [YOUR_REDMINE_HOST]/oauth_clients
- Click the Register your application link.
- The system requests the following information:
- Name is required. For example, input Jenkins
- Main Application URL is required. For example, input your jenkins url.
- Callback URL is required. For example, input [YOUR_JENKINS_HOST]/securityRealm/finishLogin
- Support URL is not required.
- Press Register. The system generates a key and a secret for you. Toggle the consumer name to see the generated Key and Secret value for your consumer.
Second, you need to configure your Jenkins.
- Open Jenkins Configure System page.
- Check Enable security.
- Select Redmine OAuth Plugin in Security Realm.
- Input your Redmine Url to Redmine Url.
- Input your Consumer Key to Client ID.
- Input your Consumer Secret to Client Secret.
- Click Save button.
$ terraform destroy
These are the requirements and steps needed for contributing to this solution.
- Install VirtualBox or libvirt
- Install Vagrant
$ vagrant up
Vagrant is going to execute the following tasks for you.
- Creation of Virtual Machines.
- Hostname and IP Configuration.
- Execution of post-install script.
Once all the Virtual Machines are up and running is possible to access them via ssh. For example, to access the Database of Redmine:
$ vagrant ssh redmine_db
$ vagrant destroy