Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 81 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,92 @@
# terraform-oci-arch-drupal

[![License: UPL](https://img.shields.io/badge/license-UPL-green)](https://img.shields.io/badge/license-UPL-green) [![Quality gate](https://sonarcloud.io/api/project_badges/quality_gate?project=oracle-devrel_terraform-oci-arch-drupal)](https://sonarcloud.io/dashboard?id=oracle-devrel_terraform-oci-arch-drupal)
This is Terraform module that deploys [Drupal](https://www.drupal.org/) on [Oracle Cloud Infrastructure (OCI)](https://cloud.oracle.com/en_US/cloud-infrastructure).

## THIS IS A NEW, BLANK REPO THAT IS NOT READY FOR USE YET. PLEASE CHECK BACK SOON!
## About
Drupal is one of the most popular content management systems (CMS) available. It is free and open-source, released under the GNU Public License.

## Introduction
MISSING
Drupal is based on the LAMP stack and provides users and enterprises a scalable and robust architecture, low implementation and maintenance efforts, as well as a large community-led knowledge base. Its setup and usage does not require advanced technical skills. It provides the infrastructure for websites worldwide—ranging from personal blogs to corporate, political, and government sites. It is very extensible and modular, making it useful in a large variety of scenarios.

## Getting Started
MISSING
## Prerequisites
1. Download and install Terraform (v1.0 or later)
2. Download and install the OCI Terraform Provider (v4.4.0 or later)
3. Export OCI credentials. (this refer to the https://github.com/oracle/terraform-provider-oci )

### Prerequisites
MISSING

## Notes/Issues
MISSING
## What's a Module?
A Module is a canonical, reusable, best-practices definition for how to run a single piece of infrastructure, such as a database or server cluster. Each Module is created using Terraform, and includes automated tests, examples, and documentation. It is maintained both by the open source community and companies that provide commercial support.
Instead of figuring out the details of how to run a piece of infrastructure from scratch, you can reuse existing code that has been proven in production. And instead of maintaining all that infrastructure code yourself, you can leverage the work of the Module community to pick up infrastructure improvements through a version number bump.

## URLs
* Nothing at this time
## How to use this Module
This Module has the following folder structure:
* [root](): This folder contains a root module.
* [examples](examples): This folder contains examples of how to use the module:
- [Drupal single-node + custom network injected into module](examples/drupal-single-mds-use-existing-network): This is an example of how to use the oci-arch-drupal module to deploy Drupal (single-node) with MDS and network cloud infrastrucutre elements injected into the module.
- [Drupal multi-node + custom network injected into module](examples/drupal-ha-mds-use-existing-network): This is an example of how to use the oci-arch-drupal module to deploy Drupal HA (multi-node) with MDS and network cloud infrastrucutre elements injected into the module.

To deploy Drupal using this Module with minimal effort use this:

```hcl
module "oci-arch-drupal" {
source = "github.com/oracle-devrel/terraform-oci-arch-drupal"
tenancy_ocid = "<tenancy_ocid>"
vcn_id = "<vcn_id>"
numberOfNodes = 1
availability_domain_name = "<availability_domain_name>"
compartment_ocid = "<compartment_ocid>""
image_id = "<image_id>"
shape = "<shape>"
flex_shape_ocpus = "<flex_shape_ocpus>"
flex_shape_memory = "<flex_shape_memory>"
label_prefix = "<label_prefix>""
ssh_authorized_keys = "<ssh_public_key>"
mds_ip = "<mysql_server_ip_address>"
drupal_subnet_id = "<drupal_subnet_id>"
admin_password = "<admin_password>"
admin_username = "<admin_username>"
drupal_schema = "<drupal_schema>"
drupal_name = "<drupal_name>"
drupal_password = "<drupal_password>"
display_name = "<drupal_instance_name>"
}
```

Argument | Description
--- | ---
compartment_ocid | Compartment's OCID where Drupal will be created
use_existing_vcn | If you want to inject already exisitng VCN then you need to set the value to TRUE.
vcn_cidr | If use_existing_vcn is set to FALSE then you can define VCN CIDR block and then it will used to create VCN within the module.
vcn_id | If use_existing_vcn is set to TRUE then you can pass VCN OCID and module will use it to create Drupal installation.
numberOfNodes | If you need HA configuration with LB and FSS then set the value to 2 or more.
drupal_subnet_id | The OCID of the drupal public (single node) and private (multi node) subnet access.
lb_subnet_id | If numberOfNodes set to 2 or more then you can provide OCID of the Load Balancer subnet.
bastion_subnet_id | If numberOfNodes set to 2 or more then you can use OCID of the Bastion subnet.
fss_subnet_id | If numberOfNodes set to 2 or more then you can use OCID of the File Storage Service subnet.
availability_domain_name | The Availability Domain for deployment.
display_name | The name of the Drupal instance.
shape | Instance shape to use for Drupal node.
flex_shape_ocpus | If shape is set to Flex shape then you can define Flex Shape OCPUs.
flex_shape_memory | If shape is set to Flex shape then you can define Flex Shape Memory (GB).
lb_shape | If numberOfNodes set to 2 or more then you can define Load Balancer shape
flex_lb_min_shape | If numberOfNodes set to 2 or more and lb_shape=flexible then you can define Load Balancer minimum shape.
flex_lb_max_shape | If numberOfNodes set to 2 or more and lb_shape=flexible then you can define Load Balancer maximum shape.
use_bastion_service | If you want to use OCI Bastion Service then you need to set the value to TRUE.
bastion_service_region | If use_bastion_service is set to TRUE then you can define bastion service region.
bastion_image_id | If use_bastion_service is set to FALSE then you can define Bastion VM image id.
bastion_shape | If use_bastion_service is set to FALSE then you can define Bastion VM shape.
bastion_flex_shape_ocpus | If use_bastion_service is set to FALSE and bastion_shape is using Flex shapes then you can define Flex Shape OCPUs.
bastion_flex_shape_memory | If use_bastion_service is set to FALSE and bastion_shape is using Flex shapes then you can define Flex Shape Memory (GB).
use_shared_storage | If numberOfNodes set to 2 or more then you can use shared NFS on OCI FSS (value TRUE). If you want to replicate Drupal by yourself (for example with rsync) then you can you can set the value to FALSE.
drupal_shared_working_dir | If numberOfNodes set to 2 or more then you can define shared mountpoint name.
label_prefix | To create unique identifier for multiple clusters in a compartment.
drupal_name | Drupal Database User Name for MySQL Server.
drupal_schema | Drupal Database User Schema for MySQL Server.
drupal_password | Drupal Database User Password for MySQL Server.
drupal_prefix | Drupal MySQL Prefix for tables (for example drupal_)
admin_username | Admin User Name for MySQL Server.
admin_password | Admin User Password for MySQL Server.
mds_ip | Private IP of the MySQL Server.
defined_tags | Defined tags to be added to compute instances.

## Contributing
This project is open source. Please submit your contributions by forking this repository and submitting a pull request! Oracle appreciates any contributions that are made by the open source community.
Expand All @@ -28,5 +97,3 @@ Copyright (c) 2022 Oracle and/or its affiliates.
Licensed under the Universal Permissive License (UPL), Version 1.0.

See [LICENSE](LICENSE) for more details.

ORACLE AND ITS AFFILIATES DO NOT PROVIDE ANY WARRANTY WHATSOEVER, EXPRESS OR IMPLIED, FOR ANY SOFTWARE, MATERIAL OR CONTENT OF ANY KIND CONTAINED OR PRODUCED WITHIN THIS REPOSITORY, AND IN PARTICULAR SPECIFICALLY DISCLAIM ANY AND ALL IMPLIED WARRANTIES OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. FURTHERMORE, ORACLE AND ITS AFFILIATES DO NOT REPRESENT THAT ANY CUSTOMARY SECURITY REVIEW HAS BEEN PERFORMED WITH RESPECT TO ANY SOFTWARE, MATERIAL OR CONTENT CONTAINED OR PRODUCED WITHIN THIS REPOSITORY. IN ADDITION, AND WITHOUT LIMITING THE FOREGOING, THIRD PARTIES MAY HAVE POSTED SOFTWARE, MATERIAL OR CONTENT TO THIS REPOSITORY WITHOUT ANY REVIEW. USE AT YOUR OWN RISK.
35 changes: 35 additions & 0 deletions examples/drupal-ha-mds-use-existing-network/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
Copyright (c) 2022 Oracle and/or its affiliates.

The Universal Permissive License (UPL), Version 1.0

Subject to the condition set forth below, permission is hereby granted to any
person obtaining a copy of this software, associated documentation and/or data
(collectively the "Software"), free of charge and under any and all copyright
rights in the Software, and any and all patent rights owned or freely
licensable by each licensor hereunder covering either (i) the unmodified
Software as contributed to or provided by such licensor, or (ii) the Larger
Works (as defined below), to deal in both

(a) the Software, and
(b) any piece of software and/or hardware listed in the lrgrwrks.txt file if
one is included with the Software (each a "Larger Work" to which the Software
is contributed by such licensors),

without restriction, including without limitation the rights to copy, create
derivative works of, display, perform, and distribute the Software and make,
use, sell, offer for sale, import, export, have made, and have sold the
Software and the Larger Work(s), and to sublicense the foregoing rights on
either these or other terms.

This license is subject to the following condition:
The above copyright notice and either this complete permission notice or at
a minimum a reference to the UPL must be included in all copies or
substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
19 changes: 19 additions & 0 deletions examples/drupal-ha-mds-use-existing-network/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
## Create Drupal multi-node + custom network injected into module
This is an example of how to use the oci-arch-drupal module to deploy Drupal HA (multi-node) with MDS and network cloud infrastrucutre elements injected into the module..

### Using this example
Update terraform.tfvars with the required information.

### Deploy the drupal
Initialize Terraform:
```
$ terraform init
```
View what Terraform plans do before actually doing it:
```
$ terraform plan
```
Use Terraform to Provision resources:
```
$ terraform apply
```
47 changes: 47 additions & 0 deletions examples/drupal-ha-mds-use-existing-network/datasources.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
## Copyright (c) 2022 Oracle and/or its affiliates.
## All rights reserved. The Universal Permissive License (UPL), Version 1.0 as shown at http://oss.oracle.com/licenses/upl

data "oci_core_images" "InstanceImageOCID" {
compartment_id = var.compartment_ocid
operating_system = var.instance_os
operating_system_version = var.linux_os_version
shape = var.node_shape

filter {
name = "display_name"
values = ["^.*Oracle[^G]*$"]
regex = true
}
}

data "oci_core_images" "InstanceImageOCID2" {
compartment_id = var.compartment_ocid
operating_system = var.instance_os
operating_system_version = var.linux_os_version
shape = var.bastion_shape

filter {
name = "display_name"
values = ["^.*Oracle[^G]*$"]
regex = true
}
}

data "oci_mysql_mysql_configurations" "shape" {
compartment_id = var.compartment_ocid
type = ["DEFAULT"]
shape_name = var.mysql_shape
}

data "oci_identity_region_subscriptions" "home_region_subscriptions" {
tenancy_id = var.tenancy_ocid

filter {
name = "is_home_region"
values = [true]
}
}

data "oci_identity_availability_domains" "ADs" {
compartment_id = var.tenancy_ocid
}
38 changes: 38 additions & 0 deletions examples/drupal-ha-mds-use-existing-network/drupal.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
## Copyright (c) 2022, Oracle and/or its affiliates.
## All rights reserved. The Universal Permissive License (UPL), Version 1.0 as shown at http://oss.oracle.com/licenses/upl

module "drupal" {
source = "github.com/oracle-devrel/terraform-oci-arch-drupal"
tenancy_ocid = var.tenancy_ocid
vcn_id = oci_core_virtual_network.drupal_mds_vcn.id
numberOfNodes = 2
availability_domain_name = var.availability_domain_name == "" ? lookup(data.oci_identity_availability_domains.ADs.availability_domains[0], "name") : var.availability_domain_name
compartment_ocid = var.compartment_ocid
image_id = lookup(data.oci_core_images.InstanceImageOCID.images[0], "id")
shape = var.node_shape
label_prefix = var.label_prefix
ssh_authorized_keys = var.ssh_public_key
mds_ip = module.mds-instance.mysql_db_system.ip_address
drupal_subnet_id = oci_core_subnet.drupal_subnet.id
lb_subnet_id = oci_core_subnet.lb_subnet_public.id
bastion_subnet_id = oci_core_subnet.bastion_subnet_public.id
fss_subnet_id = oci_core_subnet.fss_subnet_private.id
admin_password = var.admin_password
admin_username = var.admin_username
drupal_schema = var.drupal_schema
drupal_name = var.drupal_name
drupal_password = var.drupal_password
display_name = var.drupal_instance_name
flex_shape_ocpus = var.node_flex_shape_ocpus
flex_shape_memory = var.node_flex_shape_memory
lb_shape = var.lb_shape
flex_lb_min_shape = var.flex_lb_min_shape
flex_lb_max_shape = var.flex_lb_max_shape
use_bastion_service = var.use_bastion_service
bastion_image_id = lookup(data.oci_core_images.InstanceImageOCID2.images[0], "id")
bastion_shape = var.bastion_shape
bastion_flex_shape_ocpus = var.bastion_flex_shape_ocpus
bastion_flex_shape_memory = var.bastion_flex_shape_memory
bastion_service_region = var.region
}

22 changes: 22 additions & 0 deletions examples/drupal-ha-mds-use-existing-network/mds.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
## Copyright (c) 2022, Oracle and/or its affiliates.
## All rights reserved. The Universal Permissive License (UPL), Version 1.0 as shown at http://oss.oracle.com/licenses/upl

module "mds-instance" {
source = "github.com/oracle-devrel/terraform-oci-cloudbricks-mysql-database?ref=v1.0.4.1"
tenancy_ocid = var.tenancy_ocid
region = var.region
mysql_instance_compartment_ocid = var.compartment_ocid
mysql_network_compartment_ocid = var.compartment_ocid
subnet_id = oci_core_subnet.mds_subnet_private.id
mysql_db_system_admin_username = var.admin_username
mysql_db_system_admin_password = var.admin_password
mysql_db_system_availability_domain = var.availability_domain_name == "" ? lookup(data.oci_identity_availability_domains.ADs.availability_domains[0], "name") : var.availability_domain_name
mysql_shape_name = var.mysql_shape
mysql_db_system_data_storage_size_in_gb = var.mysql_db_system_data_storage_size_in_gb
mysql_db_system_description = var.mysql_db_system_description
mysql_db_system_display_name = var.mysql_db_system_display_name
mysql_db_system_fault_domain = var.mysql_db_system_fault_domain
mysql_db_system_hostname_label = var.mysql_db_system_hostname_label
mysql_db_system_is_highly_available = var.mysql_is_highly_available
mysql_db_system_maintenance_window_start_time = var.mysql_db_system_maintenance_window_start_time
}
Loading