Skip to content
This repository has been archived by the owner on May 13, 2024. It is now read-only.

Commit

Permalink
Merge pull request #3 from jeevanjoseph/master
Browse files Browse the repository at this point in the history
Re-organizing & Adding Terraform scripts to provision Apex.
  • Loading branch information
ken-tolwyn authored Mar 19, 2021
2 parents 5caa06b + 63c4914 commit 457fa58
Show file tree
Hide file tree
Showing 69 changed files with 249 additions and 51 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@

# .tfvars files
*.tfvars
.DS_Store
terraform/.terraform.lock.hcl
73 changes: 22 additions & 51 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,51 +1,22 @@
# oci-apex
This is an ansible playbook sample that will deploy [APEX](https://apex.oracle.com) on [Oracle Cloud Infrastructure (OCI)](https://cloud.oracle.com/en_US/cloud-infrastructure). It is developed jointly by Oracle and Macty.

## About
This playbook will configure a database and two ORDS servers load balanced with a self signed Certificate.

## Prerequisites
1. Ansible installed with [OCI-ansible](https://github.com/oracle/oci-ansible-modules).
2. Ensure that you have a valid OCI SDK configuration at the default config path ~/.oci/config
3. [Apex](https://www.oracle.com/tools/downloads/apex-downloads.html) and [ORDS](https://www.oracle.com/database/technologies/appdev/rest.html) installation files available through a weburl.
You can upload it into OCI storage container and create a PAR for it.

## Configurations
In host_vars/locahost configure the following:
- Set the availabliltiy domains
- Set the compartment OCID
- Set the Oracle linux OCID
- Define your ssh keys, set empty to create one
- Set the urls where we can download the ORDS and APEX zipfiles
- Verify the shapes to be used
- Set a DB password this password will also be used for the apex users
- Go over the other options and make sure they work for you

## What will be created
- VCN
- Public and Private Subnets
- Database instance
- ORDS servers
- LoadBalancers with self signed Certificate
- Bastion server


## How to run the sample
- Run the demo playbook to create the sample infrastructure in OCI. The deployment of the
Oracle database can take a long while depending on the shape used.
> $ ansible-playbook sample.yaml
- After a succesfull run it will show you the public ip of the loadbalancer to use
- access the apex server with the last part is the pluggable database name
> https://<IP>/ords/pdbprod
## Thanks and inspiration
- Secure MongoDB Deployment in OCI Using Ansible
- [WhitePaper terraform deployment](https://docs.cloud.oracle.com/iaas/Content/Resources/Assets/whitepapers/oracle-apex-on-oci-database.pdf) this provided the jetty-ords scripts for the configuration of ORDS
- Oracle engineers for their support and expertise

## To Do
- Alter the jetty configuration files to allow for different passwords used in ORDS-APEX configurations
- Have option to use autonomous database deployment
- Have option to use XE database deployment
- use letsencrypt to create Certificate
- ...
# Deploying Oracle Application Express on Oracle Cloud Infrastructure

Oracle Application Express is a low-code development platform that enables you to build scalable, secure enterprise applications with world-class features that can be deployed anywhere.

This repository provides multiple methods to automate the provisioning and management of Application Express on OCI.

Application Express provides you with an easy-to-use browser-based environment to load data, manage database objects, develop REST interfaces, and build applications which look and run great on both desktop and mobile devices. You can use Application Express to develop a wide variety of solutions: import spreadsheets and develop a single source of truth in minutes, create compelling data visualizations against your existing data, deploy productivity applications to elegantly solve a business need, or build your next mission-critical data management application.

Application Express embraces SQL. Anything you can express with SQL can be easily employed in an Application Express application. Application Express also enables low-code development, providing developers with powerful data management and data visualization components that deliver modern, responsive end-user experiences out of the box. Instead of writing code by hand, you are able to use intelligent wizards to guide you through the rapid creation of applications and components.

## Using Ansible

Ansible is an open-source software provisioning, configuration management, and application-deployment tool enabling infrastructure as code. In the `/ansible` directory you will find the ansible configuration required to deploy the Oracle database and ORDS servers that enable the Application Express platform for low code application development. You can use this to deploy and self manage an APEX instance.

## Using Terraform

Terraform is an open-source infrastructure as code software tool. You define data center infrastructure using a declarative configuration language known as HashiCorp Configuration Language (HCL) and Terraform calls the cloud APIs to create and manage the infrastructure.

The terraform configuration provided in the `/terraform` directory provides a preconfigured, fully managed and secured Application Express environment to both build and deploy world-class data-centric applications. There are no limits on the number of developers or end users for your applications.

Configuration, patching, monitoring, and upgrading of all Oracle Application Express components is fully managed by Oracle, leaving you free to focus on developing your solutions and solving your business problems. Oracle Application Express enables your organization to be more agile and develop solutions faster, for less cost, and with greater consistency. You can adapt to changing requirements with ease. And you can empower professional developers, citizen developers, and everyone else.

File renamed without changes
51 changes: 51 additions & 0 deletions ansible/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# oci-apex
This is an ansible playbook sample that will deploy [APEX](https://apex.oracle.com) on [Oracle Cloud Infrastructure (OCI)](https://cloud.oracle.com/en_US/cloud-infrastructure). It is developed jointly by Oracle and Macty.

## About
This playbook will configure a database and two ORDS servers load balanced with a self signed Certificate.

## Prerequisites
1. Ansible installed with [OCI-ansible](https://github.com/oracle/oci-ansible-modules).
2. Ensure that you have a valid OCI SDK configuration at the default config path ~/.oci/config
3. [Apex](https://www.oracle.com/tools/downloads/apex-downloads.html) and [ORDS](https://www.oracle.com/database/technologies/appdev/rest.html) installation files available through a weburl.
You can upload it into OCI storage container and create a PAR for it.

## Configurations
In host_vars/locahost configure the following:
- Set the availabliltiy domains
- Set the compartment OCID
- Set the Oracle linux OCID
- Define your ssh keys, set empty to create one
- Set the urls where we can download the ORDS and APEX zipfiles
- Verify the shapes to be used
- Set a DB password this password will also be used for the apex users
- Go over the other options and make sure they work for you

## What will be created
- VCN
- Public and Private Subnets
- Database instance
- ORDS servers
- LoadBalancers with self signed Certificate
- Bastion server


## How to run the sample
- Run the demo playbook to create the sample infrastructure in OCI. The deployment of the
Oracle database can take a long while depending on the shape used.
> $ ansible-playbook sample.yaml
- After a succesfull run it will show you the public ip of the loadbalancer to use
- access the apex server with the last part is the pluggable database name
> https://<IP>/ords/pdbprod
## Thanks and inspiration
- Secure MongoDB Deployment in OCI Using Ansible
- [WhitePaper terraform deployment](https://docs.cloud.oracle.com/iaas/Content/Resources/Assets/whitepapers/oracle-apex-on-oci-database.pdf) this provided the jetty-ords scripts for the configuration of ORDS
- Oracle engineers for their support and expertise

## To Do
- Alter the jetty configuration files to allow for different passwords used in ORDS-APEX configurations
- Have option to use autonomous database deployment
- Have option to use XE database deployment
- use letsencrypt to create Certificate
- ...
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
79 changes: 79 additions & 0 deletions terraform/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# Apex Deployment

This Terraform configuration helps you create a new fully managed APEX environment on Oracle Cloud Infrastructure.
The APEX low-code development platform available as a managed cloud service that developers can use to build data-driven enterprise applications quickly and easily.
While the original APEX platform was only available as part of the Oracle Database, APEX Application Development is available as a standalone service and works with a variety of applications.
The service supports unlimited applications, and elastically scales as additional capacity is needed.

## Deploy Using Oracle Resource Manager

1. Click [![Deploy to Oracle Cloud](https://oci-resourcemanager-plugin.plugins.oci.oraclecloud.com/latest/deploy-to-oracle-cloud.svg)]()

If you aren't already signed in, when prompted, enter the tenancy name and user credentials.

2. Review and accept the terms and conditions.

3. Select the region where you want to deploy the stack.

4. Follow the on-screen prompts and instructions to create the stack.

5. After creating the stack, click **Terraform Actions**, and select **Plan**.

6. Wait for the job to be completed, and review the plan.

To make any changes, return to the Stack Details page, click **Edit Stack**, and make the required changes. Then, run the **Plan** action again.

7. If no further changes are necessary, return to the Stack Details page, click **Terraform Actions**, and select **Apply**.

## Deploy Using the Terraform CLI

### Clone of the repo
Now, you'll want a local copy of this repo. You can make that with the commands:

```
git clone https://github.com/oracle-quickstart/oci-apex
cd oci-apex/terraform
ls
```

### Prerequisites

To get stared, you need to setup terraform to be abel to connect to your OCI tenancy and execute actions against it. That's all detailed [here](https://github.com/cloud-partners/oci-prerequisites).

Once you have terraform installed and configured, you can tell terraform how to connect to your OCI tenancy by creating a `terraform.tfvars` file and populating with the following information:

```
# Authentication
tenancy_ocid = "<tenancy_ocid>"
user_ocid = "<user_ocid>"
fingerprint = "<finger_print>"
private_key_path = "<pem_private_key_path>"
# Region
region = "<oci_region>"
# Compartment
compartment_ocid = "<compartment_ocid>"
# Jenkins password
autonomous_database_admin_password = "<jenkins_password>"
```

### Create the Resources

Run the following commands:

```
terraform init
terraform plan
terraform apply
```

### Destroy the Deployment

When you no longer need the deployment, you can run this command to destroy the resources:

```
terraform destroy
```

16 changes: 16 additions & 0 deletions terraform/apex.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
resource "oci_database_autonomous_database" "apex_instance" {
compartment_id = var.compartment_ocid
cpu_core_count = 1
db_name = "apex${random_string.deploy_id.result}"
data_storage_size_in_tbs = 1
license_model = "LICENSE_INCLUDED"
admin_password = var.autonomous_database_admin_password

db_workload = "APEX"

}

resource "random_string" "deploy_id" {
length = 4
special = false
}
4 changes: 4 additions & 0 deletions terraform/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

output "apex_url" {
value = oci_database_autonomous_database.apex_instance.connection_urls[0].apex_url
}
22 changes: 22 additions & 0 deletions terraform/provider.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

terraform {
required_providers {

oci = {
source = "hashicorp/oci"
}
random = {
source = "hashicorp/random"
}

}
required_version = ">= 0.14"
}

provider "oci" {
tenancy_ocid = var.tenancy_ocid
region = var.region
user_ocid = var.user_ocid
fingerprint = var.fingerprint
private_key_path = var.private_key_path
}
40 changes: 40 additions & 0 deletions terraform/schema.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
title: "Deploy a fully managed APEX instance"
description: "Deploy the APEX low-code application development platform as a standalone OCI managed service"
schemaVersion: 1.1.0
version: "20190304"
locale: "en"

variableGroups:
- title: General Configuration
visible: false
variables:
- tenancy_ocid
- region
- compartment_ocid

- title: Apex Configuration
visible: true
variables:
- autonomous_database_admin_password
outputs:
apex_url:
type: link
title: Apex Login
description: Open Apex
primaryOutputButton: apex_url

variables:
autonomous_database_admin_password:
type: password
required: true
title: "Apex password"
description: "Password must at least 12 characters long and include at least one uppercase letter, one lowercase letter, and one numeric character"
pattern: "^(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%^&*()_+\\-=\\[\\]{};':\\\"\\\\|,.<>\\/?]).{8,32}$"
visible: true
compartment_ocid:
type: oci:identity:compartment:id
title: "Compartment"
description: "The compartment in which to create Apex instance"
required: true


13 changes: 13 additions & 0 deletions terraform/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
variable "tenancy_ocid" {}
variable "region" {}

variable "fingerprint" {}
variable "private_key_path" {}
variable "user_ocid" {}

variable "compartment_ocid" {}


variable "autonomous_database_admin_password" {
description = "Password for Apex Admin user."
}

0 comments on commit 457fa58

Please sign in to comment.