From 058cc047efbbc9a949042a21079360f49f1872fa Mon Sep 17 00:00:00 2001 From: Guilherme Silva Date: Fri, 19 Jun 2026 11:06:23 -0300 Subject: [PATCH] Carga inicial --- .DS_Store | Bin 0 -> 6148 bytes README.md | 210 ++++++++++- boot_volume_backups.tf | 67 ++++ data_sources.tf | 32 ++ fss_server.tf | 45 +++ generation_keys.tf | 47 +++ logging_group.tf | 4 + nsg-database-nsg.tf | 37 ++ nsg-jod-servers-nsg.tf | 22 ++ nsg-memcached-servers-nsg.tf | 23 ++ nsg-sei-lbs-nsg.tf | 51 +++ nsg-sei-servers-nsg.tf | 127 +++++++ nsg-sip-servers-nsg.tf | 112 ++++++ nsg-solr-servers-nsg.tf | 51 +++ providers.tf | 17 + sei_public_load_balancer.tf | 258 ++++++++++++++ sei_waf.tf | 601 ++++++++++++++++++++++++++++++++ server_instances_jod.tf | 35 ++ server_instances_memcached.tf | 35 ++ server_instances_sei.tf | 35 ++ server_instances_sip.tf | 36 ++ server_instances_solr.tf | 35 ++ terraform.tfvars | 84 +++++ utils/cloud-init-jod.yaml | 34 ++ utils/cloud-init-memcached.yaml | 35 ++ utils/cloud-init-sei.yaml | 99 ++++++ utils/cloud-init-sip.yaml | 95 +++++ utils/cloud-init-solr.yaml | 51 +++ variables.tf | 81 +++++ variables_sei_nfs.tf | 15 + vault.tf | 15 + 31 files changed, 2387 insertions(+), 2 deletions(-) create mode 100644 .DS_Store create mode 100755 boot_volume_backups.tf create mode 100755 data_sources.tf create mode 100644 fss_server.tf create mode 100755 generation_keys.tf create mode 100644 logging_group.tf create mode 100755 nsg-database-nsg.tf create mode 100755 nsg-jod-servers-nsg.tf create mode 100755 nsg-memcached-servers-nsg.tf create mode 100755 nsg-sei-lbs-nsg.tf create mode 100755 nsg-sei-servers-nsg.tf create mode 100755 nsg-sip-servers-nsg.tf create mode 100755 nsg-solr-servers-nsg.tf create mode 100755 providers.tf create mode 100755 sei_public_load_balancer.tf create mode 100755 sei_waf.tf create mode 100755 server_instances_jod.tf create mode 100755 server_instances_memcached.tf create mode 100755 server_instances_sei.tf create mode 100755 server_instances_sip.tf create mode 100755 server_instances_solr.tf create mode 100644 terraform.tfvars create mode 100644 utils/cloud-init-jod.yaml create mode 100644 utils/cloud-init-memcached.yaml create mode 100644 utils/cloud-init-sei.yaml create mode 100644 utils/cloud-init-sip.yaml create mode 100644 utils/cloud-init-solr.yaml create mode 100644 variables.tf create mode 100644 variables_sei_nfs.tf create mode 100644 vault.tf diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..a892fd11bec9c19677f41e2c8d290409cf80d64e GIT binary patch literal 6148 zcmeHK!Ait15S^?Qsv_)3Jmv=!77t$QQmEEx|E1ViC~`VgzC&6eyu4mKa9DVYkt* zi0B0+oJ=e}OkCN-3dMxgF~1G&WC}rTl>ucSW#B*_$DIFff3N@3AbnB>l!3isz+~mD zoZ^*YZXLWF=UNMWfU>Zk7u inst } + backendset_name = oci_load_balancer_backend_set.backend_set_sip_servers.name + ip_address = each.value.private_ip + load_balancer_id = oci_load_balancer_load_balancer.sei_load_balancer_public.id + port = "80" +} + +#------------------------------------------------------------------------------------------------------------------------------------------------ +resource "oci_load_balancer_backend" "sei_servers" { + for_each = { for idx, inst in oci_core_instance.sei-instance : idx => inst } + backendset_name = oci_load_balancer_backend_set.backend_set_sei_servers.name + ip_address = each.value.private_ip + load_balancer_id = oci_load_balancer_load_balancer.sei_load_balancer_public.id + port = "80" +} +#------------------------------------------------------------------------------------------------------------------------------------------------ +resource "oci_load_balancer_backend" "solr_servers" { + for_each = { for idx, inst in oci_core_instance.solr-instance : idx => inst } + backendset_name = oci_load_balancer_backend_set.backend_set_solr_servers.name + ip_address = each.value.private_ip + load_balancer_id = oci_load_balancer_load_balancer.sei_load_balancer_public.id + port = "8983" +} +#------------------------------------------------------------------------------------------------------------------------------------------------ +resource "oci_load_balancer_listener" "lister_http_sei" { + default_backend_set_name = oci_load_balancer_backend_set.backend_set_sei_servers.name + load_balancer_id = oci_load_balancer_load_balancer.sei_load_balancer_public.id + name = "listener-sei" + port = "80" + protocol = "HTTP" + hostname_names = [ oci_load_balancer_hostname.sei_hostname.name ] +} +#------------------------------------------------------------------------------------------------------------------------------------------------ +resource "oci_load_balancer_listener" "lister_http_sip" { + default_backend_set_name = oci_load_balancer_backend_set.backend_set_sip_servers.name + load_balancer_id = oci_load_balancer_load_balancer.sei_load_balancer_public.id + name = "listener-sip" + port = "80" + protocol = "HTTP" + hostname_names = [ oci_load_balancer_hostname.sip_hostname.name ] +} +#------------------------------------------------------------------------------------------------------------------------------------------------ +resource "oci_load_balancer_listener" "lister_solr" { + default_backend_set_name = oci_load_balancer_backend_set.backend_set_solr_servers.name + load_balancer_id = oci_load_balancer_load_balancer.sei_load_balancer_public.id + name = "listener-solr" + port = "8983" + protocol = "HTTP" + hostname_names = [ oci_load_balancer_hostname.solr_hostname.name ] +} +#------------------------------------------------------------------------------------------------------------------------------------------------ +# AQUI +#------------------------------------------------------------------------------------------------------------------------------------------------ + +resource "oci_load_balancer_hostname" "sei_hostname" { + hostname = var.sei_fqdn + load_balancer_id = oci_load_balancer_load_balancer.sei_load_balancer_public.id + name = "sei-fqdn" +} + + +resource "oci_load_balancer_hostname" "sip_hostname" { + hostname = var.sip_fqdn + load_balancer_id = oci_load_balancer_load_balancer.sei_load_balancer_public.id + name = "sip-fqdn" +} + +resource "oci_load_balancer_hostname" "solr_hostname" { + hostname = var.solr_fqdn + load_balancer_id = oci_load_balancer_load_balancer.sei_load_balancer_public.id + name = "solr-fqdn" +} +#------------------------------------------------------------------------------------------------------------------------------------------------ +resource "oci_logging_log" "lb_access_log" { + display_name = "${oci_load_balancer_load_balancer.sei_load_balancer_public.display_name}-access-log" + log_group_id = oci_logging_log_group.sei_log_group.id + log_type = "SERVICE" + + configuration { + source { + source_type = "OCISERVICE" + service = "loadbalancer" + resource = oci_load_balancer_load_balancer.sei_load_balancer_public.id + category = "access" + } + + compartment_id = var.ocid_compartment_networking + } + + is_enabled = true + retention_duration = 30 +} + +resource "oci_logging_log" "lb_error_log" { + display_name = "${oci_load_balancer_load_balancer.sei_load_balancer_public.display_name}-error-log" + log_group_id = oci_logging_log_group.sei_log_group.id + log_type = "SERVICE" + + configuration { + source { + source_type = "OCISERVICE" + service = "loadbalancer" + resource = oci_load_balancer_load_balancer.sei_load_balancer_public.id + category = "error" + } + + compartment_id = var.ocid_compartment_networking + } + is_enabled = true + retention_duration = 30 +} + + + + +# resource "oci_load_balancer_listener" "lister_sei_https" { +# default_backend_set_name = oci_load_balancer_backend_set.backend_set_sei_apps.name +# load_balancer_id = oci_load_balancer_load_balancer.sei_load_balancer_public.id +# name = "listener-sei-https" +# port = "443" +# protocol = "HTTP" +# hostname_names = [ oci_load_balancer_hostname.sei_hostname.name ] +# ssl_configuration { +# certificate_ids = [ "ocid1.certificate.oc1.sa-saopaulo-1.amaaaaaaz63sg4iagucp6pedtfwbxd3oxud5ds7atsgsf2a6lwi6c5nnv7va" ] +# protocols = [ "TLSv1.2", "TLSv1.3" ] +# cipher_suite_name = "oci-default-ssl-cipher-suite-v1" +# verify_peer_certificate = "false" +# verify_depth = "1" +# } +# rule_set_names = [ oci_load_balancer_rule_set.redirectHttpToHttps.name ] +# } +# +# resource "oci_load_balancer_listener" "lister_sip_https" { +# default_backend_set_name = oci_load_balancer_backend_set.backend_set_sip_apps.name +# load_balancer_id = oci_load_balancer_load_balancer.sei_load_balancer_public.id +# name = "listener-sip-https" +# port = "443" +# protocol = "HTTP" +# hostname_names = [ oci_load_balancer_hostname.sip_hostname.name ] +# ssl_configuration { +# certificate_ids = [ "ocid1.certificate.oc1.sa-saopaulo-1.amaaaaaaz63sg4iagucp6pedtfwbxd3oxud5ds7atsgsf2a6lwi6c5nnv7va" ] +# protocols = [ "TLSv1.2", "TLSv1.3" ] +# cipher_suite_name = "oci-default-ssl-cipher-suite-v1" +# verify_peer_certificate = "false" +# verify_depth = "1" +# } +# } +##----- + +#resource "oci_load_balancer_load_balancer_routing_policy" "sei_routing_policy" { +# condition_language_version = "V1" +# load_balancer_id = oci_load_balancer_load_balancer.sei_load_balancer_public.id +# name = "RedirectHttpToHTTPs" +# rules { +# #Required +# actions { +# #Required +# backend_set_name = oci_load_balancer_backend_set.backend_set_sei_apps.name +# name = "FORWARD_TO_BACKENDSET" +# } +# condition = "any(http.request.url.path sw '/SIP')" +# name = "SIP_SERVER" +# } +#} +# +# +#resource "oci_load_balancer_rule_set" "redirectHttpToHttps" { +# items { +# action = "REDIRECT" +# conditions { +# #Required +# attribute_name = "PATH" +# attribute_value = "/" +# +# #Optional +# operator = "FORCE_LONGEST_PREFIX_MATCH" +# } +# redirect_uri { +# protocol = "HTTPS" +# host = "{host}" +# port = 443 +# path = "/{path}" +# query = "?{query}" +# } +# +# response_code = 302 +# } +# load_balancer_id = oci_load_balancer_load_balancer.sei_load_balancer_public.id +# name = "redirect_http_to_https" +#} \ No newline at end of file diff --git a/sei_waf.tf b/sei_waf.tf new file mode 100755 index 0000000..8fae8f0 --- /dev/null +++ b/sei_waf.tf @@ -0,0 +1,601 @@ +resource "oci_waf_web_app_firewall_policy" "sei-waf-policy" { + count = var.var.enable_waf == "true" ? 1 : 0 + compartment_id = var.ocid_compartment_networking + display_name = "sei-waf-policy-${var.environment}-v01" + actions { + code = 0 + name = "Pre-configured Check Action" + type = "CHECK" + } + actions { + code = 0 + name = "Pre-configured Allow Action" + type = "ALLOW" + } + + actions { + code = 401 + name = "Pre-configured 401 Response Code Action" + type = "RETURN_HTTP_RESPONSE" + body { + text = jsonencode({ + code = "401" + message = "Unauthorized" + }) + type = "STATIC_TEXT" + } + headers { + name = "Content-Type" + value = "application/json" + } + } + + actions { + code = 403 + name = "Deny Country" + type = "RETURN_HTTP_RESPONSE" + body { + text = jsonencode({ + code = "403" + message = "This is country is Forbidden request" + }) + type = "STATIC_TEXT" + } + headers { + name = "Content-Type" + value = "application/json" + } + } + request_access_control { + default_action_name = "Pre-configured Allow Action" + rules { + action_name = "Deny Country" + condition = "!i_contains(['BR'], connection.source.geo.countryCode)" + condition_language = "JMESPATH" + name = "Allow Countries" + type = "ACCESS_CONTROL" + } + } + request_protection { + body_inspection_size_limit_in_bytes = 8192 + rules { + action_name = "Pre-configured Check Action" + condition_language = "JMESPATH" + is_body_inspection_enabled = true + name = "recommended-protection-rules" + type = "PROTECTION" + protection_capabilities { + collaborative_action_threshold = 0 + key = "942270" + version = 1 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "9420000" + version = 2 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "941140" + version = 3 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "9410000" + version = 3 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "9330000" + version = 2 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "9320001" + version = 2 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "9320000" + version = 2 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "930120" + version = 2 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "9300000" + version = 2 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "920390" + version = 1 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "920380" + version = 1 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "920370" + version = 1 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "920320" + version = 1 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "920300" + version = 2 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "920280" + version = 1 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "911100" + version = 1 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "200003" + version = 1 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "200002" + version = 1 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "200001" + version = 1 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "200000" + version = 1 + } + } + rules { + action_name = "Pre-configured Check Action" + condition_language = "JMESPATH" + is_body_inspection_enabled = true + name = "mysql-protection-rules" + type = "PROTECTION" + protection_capabilities { + collaborative_action_threshold = 0 + key = "942500" + version = 1 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "942362" + version = 1 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "942360" + version = 3 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "942350" + version = 3 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "942320" + version = 2 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "942300" + version = 2 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "942270" + version = 1 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "9420000" + version = 2 + } + } + rules { + action_name = "Pre-configured Check Action" + condition_language = "JMESPATH" + is_body_inspection_enabled = true + name = "php-protection-rules" + type = "PROTECTION" + protection_capabilities { + collaborative_action_threshold = 0 + key = "933210" + version = 2 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "933200" + version = 1 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "933190" + version = 1 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "933180" + version = 2 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "933170" + version = 2 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "933161" + version = 2 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "933160" + version = 2 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "933151" + version = 3 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "933150" + version = 3 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "933140" + version = 2 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "933131" + version = 2 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "933130" + version = 3 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "933120" + version = 3 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "933111" + version = 2 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "933110" + version = 2 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "933100" + version = 3 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "9330000" + version = 2 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "202157426" + version = 1 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "202153567" + version = 1 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "202153566" + version = 1 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "921200" + version = 1 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "20224794" + version = 1 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "20224230" + version = 1 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "202221661" + version = 1 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "202156905" + version = 1 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "202156524" + version = 1 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "202156523" + version = 1 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "202155838" + version = 1 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "202155836" + version = 1 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "202155797" + version = 1 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "202155778" + version = 1 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "202154596" + version = 1 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "202142670" + version = 1 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "202142669" + version = 1 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "202132305" + version = 1 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "201950711" + version = 1 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "201950709" + version = 1 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "201950708" + version = 1 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "201949647" + version = 1 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "201949646" + version = 1 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "201949645" + version = 1 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "201947768" + version = 1 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "201947767" + version = 1 + } + } + rules { + action_name = "Pre-configured Check Action" + condition_language = "JMESPATH" + is_body_inspection_enabled = true + name = "apache-protection-rules" + type = "PROTECTION" + protection_capabilities { + collaborative_action_threshold = 0 + key = "944260" + version = 1 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "944152" + version = 1 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "944151" + version = 1 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "944150" + version = 1 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "944130" + version = 2 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "944110, 944120" + version = 1 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "944100" + version = 1 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "933161" + version = 2 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "933160" + version = 2 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "932160" + version = 3 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "932131" + version = 1 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "932130" + version = 3 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "932105" + version = 3 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "202258447" + version = 1 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "202224112" + version = 1 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "202223944" + version = 1 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "202157921" + version = 1 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "202156990" + version = 1 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "202156989" + version = 1 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "202154649" + version = 1 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "202144228" + version = 2 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "202142013" + version = 1 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "202129592" + version = 1 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "201947649" + version = 1 + } + protection_capabilities { + collaborative_action_threshold = 0 + key = "2017100" + version = 1 + } + } + } + request_rate_limiting { + } + response_access_control { + } +} + +resource "oci_waf_web_app_firewall" "sei_public_load_balancer_waf" { + count = var.enable_waf ? 1 : 0 + backend_type = "LOAD_BALANCER" + compartment_id = var.ocid_compartment_security + load_balancer_id = oci_load_balancer_load_balancer.sei_load_balancer_public.id + web_app_firewall_policy_id = oci_waf_web_app_firewall_policy.sei-waf-policy[count.index].id + display_name = oci_load_balancer_load_balancer.sei_load_balancer_public.display_name +} + +resource "oci_logging_log" "waf_log_lb_public" { + count = var.enable_waf ? 1 : 0 + display_name = "${oci_load_balancer_load_balancer.sei_load_balancer_public.display_name}-waf-log" + log_group_id = oci_logging_log_group.sei_log_group.id + log_type = "SERVICE" + configuration { + source { + category = "all" + resource = oci_waf_web_app_firewall.sei_public_load_balancer_waf[count.index].id + service = "waf" + source_type = "OCISERVICE" + } + compartment_id = var.ocid_compartment_security + } + is_enabled = "true" + retention_duration = "30" +} \ No newline at end of file diff --git a/server_instances_jod.tf b/server_instances_jod.tf new file mode 100755 index 0000000..5b07492 --- /dev/null +++ b/server_instances_jod.tf @@ -0,0 +1,35 @@ +resource "oci_core_instance" "jod-instance" { + count = var.jod_amount_instances + availability_domain = data.oci_identity_availability_domain.ad.name + fault_domain = data.oci_identity_fault_domains.fds.fault_domains[count.index % length(data.oci_identity_fault_domains.fds.fault_domains)].name + compartment_id = var.ocid_compartment_app + display_name = "${var.jod_prefix_hostname}-${var.environment}-0${count.index + 1}" + shape = var.jod_shape + shape_config { + ocpus = var.jod_amount_ocpus + memory_in_gbs = var.jod_amount_memory + } + + create_vnic_details { + subnet_id = var.ocid_subnet_app + assign_public_ip = false + } + + source_details { + source_type = "image" + source_id = data.oci_core_images.ol9_latest.images[0].id + } + + metadata = { + ssh_authorized_keys = tls_private_key.master_ssh_key.public_key_openssh + user_data = "${base64encode(file("utils/cloud-init-jod.yaml"))}" + } + + lifecycle { + ignore_changes = [ + source_details [ "source_id" ], + #metadata [ "user_data" ] + ] + } + +} \ No newline at end of file diff --git a/server_instances_memcached.tf b/server_instances_memcached.tf new file mode 100755 index 0000000..8639508 --- /dev/null +++ b/server_instances_memcached.tf @@ -0,0 +1,35 @@ +resource "oci_core_instance" "memcached-instance" { + count = var.memcached_amount_instances + availability_domain = data.oci_identity_availability_domain.ad.name + fault_domain = data.oci_identity_fault_domains.fds.fault_domains[count.index % length(data.oci_identity_fault_domains.fds.fault_domains)].name + compartment_id = var.ocid_compartment_app + display_name = "${var.memcached_prefix_hostname}-${var.environment}-0${count.index + 1}" + shape = var.memcached_shape + shape_config { + ocpus = var.memcached_amount_ocpus + memory_in_gbs = var.memcached_amount_memory + } + + create_vnic_details { + subnet_id = var.ocid_subnet_app + assign_public_ip = false + nsg_ids = [ oci_core_network_security_group.memcached-servers-nsg.id ] + } + + source_details { + source_type = "image" + source_id = data.oci_core_images.ol9_latest.images[0].id + } + + metadata = { + ssh_authorized_keys = tls_private_key.master_ssh_key.public_key_openssh + user_data = "${base64encode(file("utils/cloud-init-memcached.yaml"))}" + } + + lifecycle { + ignore_changes = [ + source_details [ "source_id" ], + #metadata [ "user_data" ] + ] + } +} \ No newline at end of file diff --git a/server_instances_sei.tf b/server_instances_sei.tf new file mode 100755 index 0000000..68e8049 --- /dev/null +++ b/server_instances_sei.tf @@ -0,0 +1,35 @@ +resource "oci_core_instance" "sei-instance" { + count = var.sei_amount_instances + availability_domain = data.oci_identity_availability_domain.ad.name + fault_domain = data.oci_identity_fault_domains.fds.fault_domains[count.index % length(data.oci_identity_fault_domains.fds.fault_domains)].name + compartment_id = var.ocid_compartment_app + display_name = "${var.sei_prefix_hostname}-${var.environment}-0${count.index + 1}" + shape = var.sei_shape + shape_config { + ocpus = var.sei_amount_ocpus + memory_in_gbs = var.sei_amount_memory + } + + create_vnic_details { + subnet_id = var.ocid_subnet_app + assign_public_ip = false + nsg_ids = [ oci_core_network_security_group.sei-public-nsg.id] + } + + source_details { + source_type = "image" + source_id = data.oci_core_images.ol9_latest.images[0].id + } + + metadata = { + ssh_authorized_keys = tls_private_key.master_ssh_key.public_key_openssh + user_data = "${base64encode(file("utils/cloud-init-sei.yaml"))}" + } + + lifecycle { + ignore_changes = [ + source_details [ "source_id" ], + #metadata [ "user_data" ] + ] + } +} \ No newline at end of file diff --git a/server_instances_sip.tf b/server_instances_sip.tf new file mode 100755 index 0000000..167b41f --- /dev/null +++ b/server_instances_sip.tf @@ -0,0 +1,36 @@ +resource "oci_core_instance" "sip-instance" { + count = var.sip_amount_instances + availability_domain = data.oci_identity_availability_domain.ad.name + fault_domain = data.oci_identity_fault_domains.fds.fault_domains[count.index % length(data.oci_identity_fault_domains.fds.fault_domains)].name + compartment_id = var.ocid_compartment_app + display_name = "${var.sip_prefix_hostname}-${var.environment}-0${count.index + 1}" + shape = var.sip_shape + shape_config { + ocpus = var.sip_amount_ocpus + memory_in_gbs = var.sip_amount_memory + } + + create_vnic_details { + subnet_id = var.ocid_subnet_app + assign_public_ip = false + nsg_ids = [ oci_core_network_security_group.sip-servers-nsg.id ] + } + + source_details { + source_type = "image" + source_id = data.oci_core_images.ol9_latest.images[0].id + } + + metadata = { + ssh_authorized_keys = tls_private_key.master_ssh_key.public_key_openssh + user_data = "${base64encode(file("utils/cloud-init-sip.yaml"))}" + } + + lifecycle { + ignore_changes = [ + source_details [ "source_id" ], + #metadata [ "user_data" ] + ] + } + +} \ No newline at end of file diff --git a/server_instances_solr.tf b/server_instances_solr.tf new file mode 100755 index 0000000..2ae4765 --- /dev/null +++ b/server_instances_solr.tf @@ -0,0 +1,35 @@ +resource "oci_core_instance" "solr-instance" { + count = var.solr_amount_instances + availability_domain = data.oci_identity_availability_domain.ad.name + fault_domain = data.oci_identity_fault_domains.fds.fault_domains[count.index % length(data.oci_identity_fault_domains.fds.fault_domains)].name + compartment_id = var.ocid_compartment_app + display_name = "${var.solr_prefix_hostname}-${var.environment}-0${count.index + 1}" + shape = var.solr_shape + shape_config { + ocpus = var.solr_amount_ocpus + memory_in_gbs = var.solr_amount_memory + } + + create_vnic_details { + subnet_id = var.ocid_subnet_app + assign_public_ip = false + nsg_ids = [ oci_core_network_security_group.solr-servers-nsg.id ] + } + + source_details { + source_type = "image" + source_id = data.oci_core_images.ol9_latest.images[0].id + boot_volume_size_in_gbs = var.solr_boot_disk_size + } + + metadata = { + ssh_authorized_keys = tls_private_key.master_ssh_key.public_key_openssh + user_data = "${base64encode(file("utils/cloud-init-solr.yaml"))}" } + + lifecycle { + ignore_changes = [ + source_details [ "source_id" ], + #metadata [ "user_data" ] + ] + } +} \ No newline at end of file diff --git a/terraform.tfvars b/terraform.tfvars new file mode 100644 index 0000000..8722862 --- /dev/null +++ b/terraform.tfvars @@ -0,0 +1,84 @@ +#================================================================================================================================================================================================ +# Parameters to authenticate with Oracle Cloud Infrastructure +tenancy_ocid = "" +user_ocid = "" +fingerprint = "" +private_key_path = "/home/opc/.oci/terraform_key.pem" +region = "sa-saopaulo-1" + +#================================================================================================================================================================================================ +# The environment that you're creating resources for: test, dev, prod, or staging +environment="hml" +#================================================================================================================================================================================================ +# The environment compartments +ocid_compartment_app = "" +ocid_compartment_database = "" +ocid_compartment_security = "" +ocid_compartment_networking = "" +#================================================================================================================================================================================================ +# The environment networks +ocid_vcn_3_tier = "" +ocid_subnet_app = "" +ocid_subnet_database = "" +ocid_subnet_public = "" +#================================================================================================================================================================================================ +# The CIDR networks +cidr_subnet_app = "172.20.2.64/26" +cidr_subnet_database = "172.20.2.128/26" +cidr_subnet_web = "172.20.2.0/26" +cidr_anywhere = "0.0.0.0/0" +#================================================================================================================================================================================================ +# SEI Variables +sei_amount_instances = "1" +sei_prefix_hostname = "sei-server" +sei_shape = "VM.Standard.E4.Flex" +sei_amount_memory = "4" +sei_amount_ocpus = "1" +sei_fqdn = "" +#================================================================================================================================================================================================ +# SIP Variables +sip_amount_instances = "1" +sip_prefix_hostname = "sip-server" +sip_shape = "VM.Standard.E4.Flex" +sip_amount_memory = "4" +sip_amount_ocpus = "1" +sip_fqdn = "" +#================================================================================================================================================================================================ +# SOLR Variables +solr_amount_instances = "2" +solr_prefix_hostname = "solr-server" +solr_shape = "VM.Standard.E4.Flex" +solr_amount_memory = "8" +solr_amount_ocpus = "1" +solr_boot_disk_size = "200" +solr_fqdn = "" +#================================================================================================================================================================================================ +# Memcached Variables +memcached_amount_instances = "1" +memcached_prefix_hostname = "memcached-server" +memcached_shape = "VM.Standard.E4.Flex" +memcached_amount_memory = "2" +memcached_amount_ocpus = "1" +#================================================================================================================================================================================================ +# JodServer Variables +jod_amount_instances = "1" +jod_prefix_hostname = "jod-server" +jod_shape = "VM.Standard.E4.Flex" +jod_amount_memory = "2" +jod_amount_ocpus = "1" +#================================================================================================================================================================================================ +# Public Load Balancer Variables +load_balancer_prefix_hostname= "sei-load-balancer" +load_balancer_maximum_bandwidth_in_mbps = "100" +load_balancer_minimum_bandwidth_in_mbps = "10" +#================================================================================================================================================================================================ +# FSS Variables +fss_backup = false +sei_nfs_name = "nfs-sei" +#================================================================================================================================================================================================ +# WAF Variables +enable_waf = false +#================================================================================================================================================================================================ +# Boot Volume Backup Variables +enable_boot_volume_backup = false +#================================================================================================================================================================================================ \ No newline at end of file diff --git a/utils/cloud-init-jod.yaml b/utils/cloud-init-jod.yaml new file mode 100644 index 0000000..a3a03b8 --- /dev/null +++ b/utils/cloud-init-jod.yaml @@ -0,0 +1,34 @@ +#cloud-config + +yum_repos: + epel: + name: Extra Packages for Enterprise Linux + baseurl: https://yum$ociregion.$ocidomain/repo/OracleLinux/OL9/developer/EPEL/$basearch/ + enabled: true + gpgcheck: true + +timezone: America/Sao_Paulo + +package_update: true +package_upgrade: true + +packages: + - vim + - wget + - libreoffice + - java-1.8.0-openjdk + - google-noto-fonts-common.noarch + - fontawesome-fonts.noarch + - google-noto-sans-cjk-ttc-fonts.noarch + +runcmd: + - [systemctl, disable, firewalld.service, --now] + - [ sed, -i, 's/^SELINUX.*/SELINUX=disabled/', /etc/selinux/config] + - [setenforce, 0] + - [localectl, set-locale, LANG=pt_BR.ISO-8859-1] + - [nmcli, conn, modify, "System enp0s5", ipv6.method, disabled] + - [nmcli, conn, modify, "Wired Connection", ipv6.method, disabled] + - [nmcli, conn, up, "Wired Connection"] + - [systemctl, restart, NetworkManager] + +final_message: "Jod Instance ready after $UPTIME seconds" \ No newline at end of file diff --git a/utils/cloud-init-memcached.yaml b/utils/cloud-init-memcached.yaml new file mode 100644 index 0000000..aae4d3a --- /dev/null +++ b/utils/cloud-init-memcached.yaml @@ -0,0 +1,35 @@ +#cloud-config + +yum_repos: + epel: + name: Extra Packages for Enterprise Linux + baseurl: https://yum$ociregion.$ocidomain/repo/OracleLinux/OL9/developer/EPEL/$basearch/ + enabled: true + gpgcheck: true + +timezone: America/Sao_Paulo + +package_update: true +package_upgrade: true + +packages: + - gcc + - curl-devel + - java-1.8.0-openjdk + - php-opcache.x86_64 + - glibc-langpack-pt + - langpacks-pt + - memcached + +runcmd: + - [systemctl, disable, firewalld.service, --now] + - [setenforce, 0] + - [sed, -i, 's/^SELINUX.*/SELINUX=disabled/', /etc/selinux/config] + - [localectl, set-locale, LANG=pt_BR.ISO-8859-1] + - [nmcli, conn, modify, "System enp0s5", ipv6.method, disabled] + - [nmcli, conn, modify, "Wired Connection", ipv6.method, disabled] + - [nmcli, conn, up, "Wired Connection"] + - [systemctl, restart, NetworkManager] + - [systemctl, enable, memcached.service, --now] + +final_message: "MemCache Instance ready after $UPTIME seconds" \ No newline at end of file diff --git a/utils/cloud-init-sei.yaml b/utils/cloud-init-sei.yaml new file mode 100644 index 0000000..991367c --- /dev/null +++ b/utils/cloud-init-sei.yaml @@ -0,0 +1,99 @@ +#cloud-config + +yum_repos: + epel: + name: Extra Packages for Enterprise Linux + baseurl: https://yum$ociregion.$ocidomain/repo/OracleLinux/OL9/developer/EPEL/$basearch/ + enabled: true + gpgcheck: true + +timezone: America/Sao_Paulo + +package_update: true +package_upgrade: true + +write_files: + - path: /tmp/robots.txt + owner: 'root:root' + permissions: '0644' + defer: true + content: | + User-agent: * + Disallow: / + + - path: /tmp/sei.conf + owner: 'root:root' + permissions: '0644' + defer: true + content: | + Alias "/infra_css" "/opt/infra/infra_css" + Alias "/infra_js" "/opt/infra/infra_js" + + AllowOverride None + Require all denied + + + AllowOverride None + Options None + Require all granted + + +runcmd: + - sudo systemctl disable firewalld.service --now + - sudo setenforce 0 + - sudo dnf install httpd mod_ssl @php:8.2 php-bcmath.x86_64 php-gd.x86_64 php-soap.x86_64 php-pecl-zip.x86_64 php-pear gcc curl-devel php-devel zlib-devel pcre-devel php-intl.x86_64 java-1.8.0-openjdk php-opcache.x86_64 glibc-langpack-pt langpacks-pt php-mysqlnd.x86_64 -y + - sudo pecl install igbinary memcache uploadprogress + - echo "extension=memcache" | sudo tee -a /etc/php.d/20-memcache.ini + - echo "extension=igbinary" | sudo tee -a /etc/php.d/20-igbinary.ini + - echo "extension=uploadprogress" | sudo tee -a /etc/php.d/20-uploadprogress.ini + - sudo sed -i '124c\DocumentRoot "/opt/sei/web"' /etc/httpd/conf/httpd.conf + - sudo sed -i '136c\' /etc/httpd/conf/httpd.conf + - sudo dnf install -y https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-3/wkhtmltox-0.12.6.1-3.almalinux9.x86_64.rpm + - sudo ln -sf /usr/local/bin/wkhtmltopdf /usr/bin/ + - sudo localectl set-locale LANG=pt_BR.ISO-8859-1 + - sudo sed -i '1342c\session.gc_maxlifetime = 28800' /etc/php.ini + - sudo sed -i '198c\short_open_tag = On' /etc/php.ini + - sudo sed -i '426c\max_input_vars = 1000' /etc/php.ini + - sudo sed -i '561c\html_errors = off' /etc/php.ini + - sudo sed -i '703c\post_max_size = 201M' /etc/php.ini + - sudo sed -i '855c\upload_max_filesize = 200M' /etc/php.ini + - sudo sed -i '1276c\session.cookie_secure = 1' /etc/php.ini + - sudo sed -i '722c\default_charset = "ISO-8859-1"' /etc/php.ini + - sudo sed -i '47c\Listen 0.0.0.0:80' /etc/httpd/conf/httpd.conf + - sudo sed -i '115c\pm.max_children = 92' /etc/php-fpm.d/www.conf + - sudo sed -i '120c\pm.start_servers = 8' /etc/php-fpm.d/www.conf + - sudo sed -i '125c\pm.min_spare_servers = 4' /etc/php-fpm.d/www.conf + - sudo sed -i '130c\pm.max_spare_servers = 35' /etc/php-fpm.d/www.conf + - sudo sed -i '141c\pm.max_requests = 500' /etc/php-fpm.d/www.conf + - sudo sed -i '745c\include_path = "/opt/infra/infra_php"' /etc/php.ini + - sudo sed -i '22c\SELINUX=disabled' /etc/selinux/config + - sudo sed -i "11c\opcache.opcache.memory_consumption=256" /etc/php.d/10-opcache.ini + - sudo sed -i "14c\opcache.opcache.interned_strings_buffer=16" /etc/php.d/10-opcache.ini + - sudo sed -i "18c\opcache.opcache.max_accelerated_files=50000" /etc/php.d/10-opcache.ini + - sudo sed -i "31c\opcache.validate_timestamps=0" /etc/php.d/10-opcache.ini + - sudo sed -i "36c\opcache.revalidate_freq=0" /etc/php.d/10-opcache.ini + - mkdir -p /sei-nfs/dados + - mkdir -p /run/php-fpm + - echo "opcache.jit = 1254" | sudo tee -a /etc/php.d/10-opcache.ini + - echo "opcache.jit_buffer_size = 256M" | sudo tee -a /etc/php.d/10-opcache.ini + - sudo echo -e "#Desabilitar output buffer e alterar timeout\n\n ProxySet enablereuse=off flushpackets=auto timeout=610 keepalive=on\n\n#forcar envio de Content-Length quando não informado\nSetEnv proxy-sendcl 1" >> /etc/httpd/conf/httpd.conf + - sudo mkdir -p /opt/infra/infra_php + - sudo mkdir -p /opt/sei/web + - sudo mkdir -p /sei-nfs/dados + - sudo cp /tmp/robots.txt /opt/sei/robots.txt + - sudo cp /tmp/sei.conf /etc/httpd/conf.d/sei.conf + - sudo chown -R root:apache /opt/infra + - sudo chown -R root:apache /opt/sei + - sudo chown -R root:apache /var/www + - sudo openssl req -x509 -nodes -newkey rsa:4096 -keyout /etc/pki/tls/private/localhost.key -out /etc/pki/tls/certs/localhost.crt -days 3650 -subj '/CN=localhost' + - sudo rm -f /etc/httpd/conf.d/{userdir.conf,welcome.conf} + - sudo systemctl enable php-fpm.service --now + - sudo systemctl enable httpd.service --now + - sudo systemctl restart php-fpm.service + - sudo systemctl restart httpd.service + - sudo nmcli conn modify enp0s5 ipv6.method disabled + - sudo systemctl restart NetworkManager + - echo "00 01 * * * root rm -rf /opt/sei/temp/*" | sudo crontab + - sudo systemctl reload crond.service + +final_message: "SEI Instance ready after $UPTIME seconds" \ No newline at end of file diff --git a/utils/cloud-init-sip.yaml b/utils/cloud-init-sip.yaml new file mode 100644 index 0000000..4826dbf --- /dev/null +++ b/utils/cloud-init-sip.yaml @@ -0,0 +1,95 @@ +#cloud-config + +yum_repos: + epel: + name: Extra Packages for Enterprise Linux + baseurl: https://yum$ociregion.$ocidomain/repo/OracleLinux/OL9/developer/EPEL/$basearch/ + enabled: true + gpgcheck: true + +timezone: America/Sao_Paulo + +package_update: true +package_upgrade: true + +write_files: + - path: /tmp/robots.txt + owner: 'root:root' + permissions: '0644' + defer: true + content: | + User-agent: * + Disallow: / + + - path: /tmp/sip.conf + owner: 'root:root' + permissions: '0644' + defer: true + content: | + Alias "/infra_css" "/opt/infra/infra_css" + Alias "/infra_js" "/opt/infra/infra_js" + + AllowOverride None + Require all denied + + + AllowOverride None + Options None + Require all granted + + +runcmd: + - sudo systemctl disable firewalld.service --now + - sudo setenforce 0 + - sudo dnf install httpd mod_ssl @php:8.2 php-bcmath.x86_64 php-gd.x86_64 php-soap.x86_64 php-pecl-zip.x86_64 php-pear gcc curl-devel php-devel zlib-devel pcre-devel php-intl.x86_64 java-1.8.0-openjdk php-opcache.x86_64 glibc-langpack-pt langpacks-pt php-mysqlnd.x86_64 -y + - sudo pecl install igbinary memcache uploadprogress + - echo "extension=memcache" | sudo tee -a /etc/php.d/20-memcache.ini + - echo "extension=igbinary" | sudo tee -a /etc/php.d/20-igbinary.ini + - echo "extension=uploadprogress" | sudo tee -a /etc/php.d/20-uploadprogress.ini + - sudo sed -i '124c\DocumentRoot "/opt/sip/web"' /etc/httpd/conf/httpd.conf + - sudo sed -i '136c\' /etc/httpd/conf/httpd.conf + - sudo dnf install -y https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-3/wkhtmltox-0.12.6.1-3.almalinux9.x86_64.rpm + - sudo ln -sf /usr/local/bin/wkhtmltopdf /usr/bin/ + - sudo localectl set-locale LANG=pt_BR.ISO-8859-1 + - sudo sed -i '1342c\session.gc_maxlifetime = 28800' /etc/php.ini + - sudo sed -i '198c\short_open_tag = On' /etc/php.ini + - sudo sed -i '426c\max_input_vars = 1000' /etc/php.ini + - sudo sed -i '561c\html_errors = off' /etc/php.ini + - sudo sed -i '703c\post_max_size = 201M' /etc/php.ini + - sudo sed -i '855c\upload_max_filesize = 200M' /etc/php.ini + - sudo sed -i '1276c\session.cookie_secure = 1' /etc/php.ini + - sudo sed -i '722c\default_charset = "ISO-8859-1"' /etc/php.ini + - sudo sed -i '47c\Listen 0.0.0.0:80' /etc/httpd/conf/httpd.conf + - sudo sed -i '115c\pm.max_children = 92' /etc/php-fpm.d/www.conf + - sudo sed -i '120c\pm.start_servers = 8' /etc/php-fpm.d/www.conf + - sudo sed -i '125c\pm.min_spare_servers = 4' /etc/php-fpm.d/www.conf + - sudo sed -i '130c\pm.max_spare_servers = 35' /etc/php-fpm.d/www.conf + - sudo sed -i '141c\pm.max_requests = 500' /etc/php-fpm.d/www.conf + - sudo sed -i '745c\include_path = "/opt/infra/infra_php"' /etc/php.ini + - sudo sed -i '22c\SELINUX=disabled' /etc/selinux/config + - echo "opcache.jit = 1254" | sudo tee -a /etc/php.d/10-opcache.ini + - echo "opcache.jit_buffer_size = 256M" | sudo tee -a /etc/php.d/10-opcache.ini + - sudo echo -e "#Desabilitar output buffer e alterar timeout\n\n ProxySet enablereuse=off flushpackets=auto timeout=610 keepalive=on\n\n#forcar envio de Content-Length quando não informado\nSetEnv proxy-sendcl 1" >> /etc/httpd/conf/httpd.conf + - sudo mkdir -p /opt/infra + - sudo mkdir -p /opt/sip + - sudo chown -R root:apache /opt/infra + - sudo chown -R root:apache /opt/sip + - sudo chown -R root:apache /var/www + - sudo chown -R apache:apache /run/php-fpm + - sudo cp /tmp/robots.txt /opt/sip/robots.txt + - sudo cp /tmp/sei.conf /etc/httpd/conf.d/sip.conf + - sudo rm -f /etc/httpd/conf.d/{userdir.conf,welcome.conf} + - sudo systemctl enable php-fpm.service --now + - sudo systemctl enable httpd.service --now + - sudo systemctl restart httpd.service + - sudo systemctl restart php-fpm.service + - echo "00 01 * * * root rm -rf /opt/sip/temp/*" | sudo crontab + - sudo systemctl reload crond.service + - sudo nmcli conn modify enp0s5 ipv6.method disabled + - sudo nmcli conn modify "System enp0s5" ipv6.method disabled + - sudo nmcli conn modify "Wired Connection" ipv6.method disabled + - sudo nmcli conn up "Wired Connection" + - sudo systemctl restart NetworkManager + +final_message: "SIP Instance ready after $UPTIME seconds" + diff --git a/utils/cloud-init-solr.yaml b/utils/cloud-init-solr.yaml new file mode 100644 index 0000000..68f6537 --- /dev/null +++ b/utils/cloud-init-solr.yaml @@ -0,0 +1,51 @@ +#cloud-config + +yum_repos: + epel: + name: Extra Packages for Enterprise Linux + baseurl: https://yum$ociregion.$ocidomain/repo/OracleLinux/OL9/developer/EPEL/$basearch/ + enabled: true + gpgcheck: true + +timezone: America/Sao_Paulo + +package_update: true +package_upgrade: true + +packages: + - lsof + - java-17-openjdk + - java-17-openjdk-devel + +runcmd: + - [systemctl, disable, firewalld.service, --now] + - [setenforce, 0] + - [sysctl, -p] + - [mkdir, /dados] + - [localectl, set-locale, LANG=pt_BR.UTF-8] + - [wget, https://objectstorage.sa-saopaulo-1.oraclecloud.com/p/sCbg0kkAI_DOehFCLxUFg_LN9ypX0vXddkxj7A__uxtCrD1AkBUZnH-8ixMgCPCI/n/gr2g2eizhkzs/b/bucket-sei/o/solr-9.6.1.tgz, -O, /tmp/solr-9.6.1.tgz] + - [tar, -xvf, /tmp/solr-9.6.1.tgz, -C, /tmp/] + - [/tmp/solr-9.6.1/bin/install_solr_service.sh, /tmp/solr-9.6.1.tgz] + - [sed, -i, 's/^SELINUX.*/SELINUX=disabled/', /etc/selinux/config] + - [/usr/libexec/oci-growfs, -y] + - IP=$(ip -o -4 addr show | awk '{print $4}' | cut -d/ -f1 | sed -n '2p') && sed -i "s|^#SOLR_HOST.*|SOLR_HOST=${IP}|" /etc/default/solr.in.sh + - [sed, -i, 's/^#SOLR_JAVA_MEM.*/SOLR_JAVA_MEM="-Xms512m -Xmx28g"/', /etc/default/solr.in.sh] + - [sed, -i, 's/^#SOLR_JETTY_HOST.*/SOLR_JETTY_HOST="0.0.0.0"/', /etc/default/solr.in.sh] + - [sed, -i, 's/^#SOLR_REQUESTLOG_ENABLED.*/SOLR_REQUESTLOG_ENABLED=false/', /etc/default/solr.in.sh] + - [sed, -i, 's|^#SOLR_OPTS.*|SOLR_OPTS="$SOLR_OPTS -Dsolr.allowPaths=/dados|-Djava.net.preferIPv4Stack=true"|', /etc/default/solr.in.sh] + - [service, solr, stop] + - [systemctl, enable, --now, solr.service] + - [systemctl, start, solr.service] + - [nmcli, conn, modify, "System enp0s5", ipv6.method, disabled] + - [nmcli, conn, modify, "Wired Connection", ipv6.method, disabled] + - [nmcli, conn, up, "Wired Connection"] + - [systemctl, restart, NetworkManager] + - [/usr/libexec/oci-growfs, -y] + +final_message: "SOLR Instance ready after $UPTIME seconds" + + + + + + diff --git a/variables.tf b/variables.tf new file mode 100644 index 0000000..cf60787 --- /dev/null +++ b/variables.tf @@ -0,0 +1,81 @@ +variable "tenancy_ocid" {} +variable "user_ocid" {} +variable "fingerprint" {} +variable "private_key_path" {} +variable "region" {} +variable "environment" { + type = string +} + +# Comparments +variable "ocid_compartment_app" {} +variable "ocid_compartment_database" {} +variable "ocid_compartment_security" {} +variable "ocid_compartment_networking" {} + +# The environment networks +variable "ocid_vcn_3_tier" {} +variable "ocid_subnet_app" {} +variable "ocid_subnet_database" {} +variable "ocid_subnet_public" {} + +# SEI Variables +variable "sei_amount_instances" {} +variable "sei_prefix_hostname" {} +variable "sei_shape" {} +variable "sei_amount_memory" {} +variable "sei_amount_ocpus" {} +variable "sei_fqdn" {} + + +# SIP Variables +variable "sip_amount_instances" {} +variable "sip_prefix_hostname" {} +variable "sip_shape" {} +variable "sip_amount_memory" {} +variable "sip_amount_ocpus" {} +variable "sip_fqdn" {} + +# SOLR Variables +variable "solr_amount_instances" {} +variable "solr_prefix_hostname" {} +variable "solr_shape" {} +variable "solr_amount_memory" {} +variable "solr_amount_ocpus" {} +variable "solr_boot_disk_size" {} +variable "solr_fqdn" {} + +# Memcached Variables +variable "memcached_amount_instances" {} +variable "memcached_prefix_hostname" {} +variable "memcached_shape" {} +variable "memcached_amount_memory" {} +variable "memcached_amount_ocpus" {} + +# JodServer Variables +variable "jod_amount_instances" {} +variable "jod_prefix_hostname" {} +variable "jod_shape" {} +variable "jod_amount_memory" {} +variable "jod_amount_ocpus" {} + +# Public Load Balancer Variables +variable "load_balancer_prefix_hostname" {} +variable "load_balancer_maximum_bandwidth_in_mbps" {} +variable "load_balancer_minimum_bandwidth_in_mbps" {} + +# FSS +variable "fss_backup" {} +variable "sei_nfs_name" {} + +# WAF +variable "enable_waf" {} + +# Backup Boot Volumes +variable "enable_boot_volume_backup" {} + +# The CIDR networks +variable "cidr_subnet_app" {} +variable "cidr_subnet_database" {} +variable "cidr_subnet_web" {} +variable "cidr_anywhere" {} \ No newline at end of file diff --git a/variables_sei_nfs.tf b/variables_sei_nfs.tf new file mode 100644 index 0000000..8f8d0db --- /dev/null +++ b/variables_sei_nfs.tf @@ -0,0 +1,15 @@ +# Copyright (c) 2023, 2025, Oracle and/or its affiliates. +# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/ + +# ------------------------------------------------------ +variable "sei_nfs_name" { + type = string + default = "nfs-sei" + description = "Nome do FSS para o SEI" +} + +variable "sei_mount_target_ip_address" { + type = string + default = "10.191.228.100" + description = "IP Address para o mount target" +} \ No newline at end of file diff --git a/vault.tf b/vault.tf new file mode 100644 index 0000000..92910b1 --- /dev/null +++ b/vault.tf @@ -0,0 +1,15 @@ +resource "oci_kms_vault" "vault-sei" { + compartment_id = var.ocid_compartment_security + display_name = "sei-vault-${var.environment}" + vault_type = "DEFAULT" +} + +resource "oci_kms_key" "sei-vault-keys" { + compartment_id = var.ocid_compartment_security + display_name = "sei-vault-${var.environment}" + management_endpoint = oci_kms_vault.vault-sei.management_endpoint + key_shape { + algorithm = "AES" + length = "32" + } +} \ No newline at end of file