Skip to content

Commit 7883e66

Browse files
Add solutions folder (#326)
The docs/examples folder currently contains a mix of low-level examples and very high level "how to complete scenario X" examples. This change starts the migration of that second cagetory into a new section under docs/solutions. (There are a few other examples that should probably be moved as well, but I need to get signoff from the owners first.) This also adds a placeholder for an upcoming SQL Server solution.
1 parent 74432fc commit 7883e66

File tree

54 files changed

+310
-307
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+310
-307
lines changed
Lines changed: 1 addition & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1 @@
1-
# ___ ____ _ ____ _ _____
2-
# / _ \| _ \ / \ / ___| | | ____|
3-
# | | | | |_) | / _ \| | | | | _|
4-
# | |_| | _ < / ___ | |___| |___| |___
5-
# \___/|_| \_/_/ \_\____|_____|_____|
6-
***
7-
## Bootstrap an instance as a Chef node
8-
This example shows how to use Terraform to bootstrap an OCI instance as a Chef node, register it with an existing Chef server, and run a recipe. When the plan completes, you will have a running web server with content and the correct firewall configuration.
9-
10-
### Prerequisites
11-
12-
* `knife` must be installed and configured in your PATH. This allows the Chef node deletion to work properly when `terraform destroy` is called.
13-
* Access to a Chef server to upload the example_webserver recipe to.
14-
15-
### Using this example
16-
* Update env-vars with the required information. Most examples use the same set of environment variables so you only need to do this once.
17-
* Source env-vars
18-
* `$ . env-vars`
19-
* Update `variables.tf` with your instance options.
20-
* Upload the example Chef recipe and its dependencies to your Chef server.
21-
* `$ cd cookbooks/example_webserver`
22-
* `$ berks install`
23-
* `$ berks upload`
24-
* Run `terraform apply` from the instance_chef directory.
25-
* Navigate to the public IP address (reported by Terraform, above) in your browser.
26-
27-
### Files in the configuration
28-
29-
#### `env-vars`
30-
Is used to export the environmental variables used in the configuration. These are usually authentication related, be sure to exclude this file from your version control system. It's typical to keep this file outside of the configuration.
31-
32-
Before you plan, apply, or destroy the configuration source the file -
33-
`$ . env-vars`
34-
35-
#### `compute.tf`
36-
Defines the compute resource. This demo connects to the running instance
37-
so you will need to supply public/private keys to create an ssh connection.
38-
**NOTE**: do not try to use your api keys, see [this doc](https://docs.us-phoenix-1.oraclecloud.com/Content/Compute/Tasks/managingkeypairs.htm)
39-
for more info on configuring keys.
40-
41-
#### `./userdata/bootstrap`
42-
The user-data script that gets injected into the instance on launch. More information on user-data scripts can be [found at the cloud-init project.](https://cloudinit.readthedocs.io/en/latest/topics/format.html)
43-
44-
#### `variables.tf`
45-
Defines the variables used in the configuration
46-
47-
#### `datasources.tf`
48-
Defines the datasources used in the configuration
49-
50-
#### `outputs.tf`
51-
Defines the outputs of the configuration
52-
53-
#### `provider.tf`
54-
Specifies and passes authentication details to the OCI TF provider
55-
56-
#### `./cookbooks/example_webserver/recipes/default.rb`
57-
Installs a web server and configures the firewall to allow inbound http and ssh connections.
1+
This example has been moved to [docs/solutions/chef/](https://github.com/oracle/terraform-provider-oci/tree/master/docs/solutions/chef/).
Lines changed: 1 addition & 250 deletions
Original file line numberDiff line numberDiff line change
@@ -1,250 +1 @@
1-
# ___ ____ _ ____ _ _____
2-
# / _ \| _ \ / \ / ___| | | ____|
3-
# | | | | |_) | / _ \| | | | | _|
4-
# | |_| | _ < / ___ | |___| |___| |___
5-
# \___/|_| \_/_/ \_\____|_____|_____|
6-
***
7-
## Oracle Cloud Infrastructure Instance monitored with Oracle Management Cloud Agent
8-
9-
10-
### Prerequisites
11-
12-
- Subscription to the Oracle Management Cloud Service -https://cloud.oracle.com/management
13-
- Download the AgentInstall.zip - https://docs.oracle.com/en/cloud/paas/management-cloud/emcad/deploying-oracle-management-cloud-agents.html
14-
- Generate the registration key for your agent - https://docs.oracle.com/en/cloud/paas/management-cloud/emcad/managing-registration-keys.html
15-
- Instances in your subnet properly return their FQDN from hostname -f. This is a requirement for the OMC agent to install properly.
16-
To ensure this create your subnet with a custom DHCP provider. The custom DHCP provider should be configured with a search domain that matches
17-
"subnet dns label"."vcn dns label".oraclevcn.com
18-
https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Tasks/managingDHCP.htm?Highlight=dhcp%20provider
19-
20-
### Optional
21-
22-
- Chef Server - to use example three where Chef is used to configure the instance you need to have access to a Chef server
23-
to upload the provided cookbook for OMC.
24-
25-
### Running this example
26-
* Update env-vars with the required information. Most examples use the same set of environment variables so you only need to do this once.
27-
* Source env-vars
28-
* `$ . env-vars`
29-
30-
* This example demonstrates three options to create an OMC managed instance.
31-
32-
1. Single stage deploy, install and configure the agent. This approach takes about 12-15 minutes to bring a single server online.
33-
2. Two stage deploy, where we first stage the agent on an instance and create and image that we can reuse. Staging the agent allows you to do the time consuming work one time, and create an image to be used to configure the agent on demand.
34-
3. Terraform and Chef, where Chef is used to do all the post instance creation configuration of the OMC agent.
35-
36-
### 1. Single stage deploy & monitor
37-
* Deploy and configure the agent on an instance in a single step
38-
* `$ cd stage_and_monitor_instance`
39-
* Update example.tfvars with your specific details
40-
* Region where you want to deploy
41-
* The compartment name to run your instance
42-
* The OCID for the subnet where you want your instance to run.
43-
* It is required that this subnet be public and allow SSH traffic
44-
* The path to your AgentInstall.zip
45-
* Your Agent registration key
46-
* Load the resource module
47-
* `$ terraform get`
48-
* `$ terraform plan -var-file=example.tfvars`
49-
* `$ terraform apply -var-file=example.tfvars`
50-
51-
### 2. Two stage deploy & monitor
52-
* Create your base server with the agent installed
53-
* `$ cd stage_server`
54-
* Update example.tfvars with your specific details
55-
* Region where you want to deploy
56-
* The compartment name to run your instance
57-
* The OCID for the subnet where you want your instance to run.
58-
* It is required that this subnet be public and allow SSH traffic
59-
* The path to your AgentInstall.zip
60-
* Your Agent registration key
61-
* Load the resource module
62-
* `$ terraform get`
63-
* `$ terraform plan -var-file=example.tfvars`
64-
* `$ terraform apply -var-file=example.tfvars`
65-
* Once your instance is running, goto the console, and create a custom image from this server. Note the ocid of the image that is created.
66-
* `$ terraform destroy -var-file=example.tfvars `
67-
* With your custom image created change to the create_omc_managed_server directory to create an instance that is managed by OMC.
68-
* `$ cd ../monitor_instance`
69-
* Update example.tfvars with your specific details
70-
* Region where you want to deploy
71-
* The compartment name to run your instance
72-
* The OCID for the subnet where you want your instance to run.
73-
* It is required that this subnet be public and allow SSH traffic
74-
* Your Agent registration key
75-
* OCID of the image you created in the previous step
76-
* `$ terraform get`
77-
* `$ terraform plan -var-file=example.tfvars`
78-
* `$ terraform apply -var-file=example.tfvars`
79-
80-
81-
### 3. Chef stage, deploy & monitor
82-
* Use Terraform with Chef to create and configure a server instance
83-
* `$ cd chef_stage_and_monitor_instance`
84-
* We first need to upload the provided omc cookbook and users databag to your chef server. Assuming your knife.rb
85-
configuration file is in your current path. Run the following commands
86-
* `$ cd cookbooks/omc`
87-
* Add your AgentInstall.zip file downloaded from OMC to the files/default directory.
88-
* Review the templates/default/omc_entity.json.erb file to see the entity configuration we will load by default.
89-
* `$ berks install`
90-
* `$ berks upload`
91-
* `$ cd ../../data-bag/users`
92-
* Edit the omc.json file providing a ssh public key pair that will be used to ssh to the server as the omc user.
93-
* `$ knife data bag create users`
94-
* `$ knife data bag from file users omc.json`
95-
* Validate on your chef server that the omc cookbook and dependcies have been uploaded
96-
* Validate on your chef server that the users databag has been created with user omc.
97-
* From the examples root directory
98-
* `$ cd chef_stage_and_monitor_instance`
99-
* Edit the chef_attributes.json file with your OMC Agent Registration key
100-
* There are 3 tf.vars files you can run this example with
101-
* stage_and_monitor.tfvars
102-
* All in one to launch an instance, stage the agent, and monitors a server instance.
103-
* stage.tfvars
104-
* Creates a staged server instance, that you will create a custom image from.
105-
* monitor.tfvars
106-
* Uses a custom image created in the previous step, to launch a server instance that is monitored by OMC.
107-
* Each of the .tfvars need to be updated with your specific details
108-
* Region where you want to deploy
109-
* The compartment name to run your instance
110-
* The OCID for the subnet where you want your instance to run.
111-
* It is required that this subnet be public and allow SSH traffic
112-
* It is required that this subnet have a custom DHCP provider with a proper seach domain.
113-
* Chef Server configuration details
114-
* chef_server - Server URL
115-
* chef_user - Chef Client Username
116-
* chef_key - Chef Client private key
117-
* chef_node_name - Chef node name
118-
* The run list and json_attributes do not need to be changed
119-
* Load the resource module
120-
* `$ terraform get`
121-
* `$ terraform plan -var-file=stage_and_monitor.tfvars`
122-
* `$ terraform apply -var-file=stage_and_monitor.tfvars`
123-
124-
* Build the base image
125-
* `$ terraform plan -var-file=stage.tfvars`
126-
* `$ terraform apply -var-file=stage.tfvars`
127-
* Once up and running via the console create a custom image from this server, and note the OCID of the image.
128-
129-
* Create a monitored server from the base image
130-
* Update the monitor.tfvars with the ocid of your custom staged image
131-
* `$ terraform plan -var-file=monitor.tfvars`
132-
* `$ terraform apply -var-file=monitor.tfvars`
133-
134-
135-
## Files in the configuration
136-
137-
#### `env-vars`
138-
Is used to export the environmental variables used in the configuration. These are usually authentication related, be sure to exclude this file from your version control system. It's typical to keep this file outside of the configuration.
139-
140-
Before you plan, apply, or destroy the configuration source the file -
141-
`$ . env-vars`
142-
143-
### Modules/datasources
144-
145-
#### `datasources.tf`
146-
Reads OCI environment specific values for ADs, and Compartments used in the configuration
147-
148-
149-
### Stage Server
150-
151-
152-
#### `main.tf`
153-
Defines the compute resource
154-
155-
#### `provider.tf`
156-
Specifies and passes authentication details to the OCI TF provider
157-
158-
#### `./userdata/*`
159-
The user-data scripts that get injected into an instance on launch. More information on user-data scripts can be [found at the cloud-init project.](https://cloudinit.readthedocs.io/en/latest/topics/format.html)
160-
This script creates an Oracle user, installs the necessary packages to install the agent, and creates the directory structure of the install. /omc path on the host
161-
162-
#### `variables.tf`
163-
Defines the variables used in the configuration
164-
165-
#### `example.tfvars`
166-
Environment specific values passed into configuration.
167-
168-
### Monitor Instance
169-
170-
#### `main.tf`
171-
Defines the compute resource that is monitored by OMC
172-
173-
#### `provider.tf`
174-
Specifies and passes authentication details to the OCI TF provider
175-
176-
#### `./userdata/*`
177-
The user-data scripts that get injected into an instance on launch. More information on user-data scripts can be [found at the cloud-init project.](https://cloudinit.readthedocs.io/en/latest/topics/format.html)
178-
This script creates an Oracle user, installs the necessary packages to install the agent, and creates the directory structure of the install. /omc path on the host
179-
180-
#### `./omc_config/install_omc.tpl`
181-
Installation script template file for the agent, and the monitoring configuration file. This file is read by Terraform
182-
and passed the registration key value.
183-
184-
#### `./omc_config/omc_entity.json`
185-
OMC agent entity configuration file. This file is loaded to the server, and passed to omcli utility to configure
186-
the agent.
187-
188-
#### `variables.tf`
189-
Defines the variables used in the configuration
190-
191-
#### `example.tfvars`
192-
Environment specific values passed into configuration.
193-
194-
### Stage and Monitor Instance
195-
196-
#### `main.tf`
197-
Defines the compute resource that is monitored by OMC
198-
199-
#### `provider.tf`
200-
Specifies and passes authentication details to the OCI TF provider
201-
202-
#### `./omc_config/install_omc.tpl`
203-
Installation script template file for the agent, and the monitoring configuration file. This file is read by Terraform
204-
and passed the registration key value.
205-
206-
#### `./omc_config/omc_entity.json`
207-
OMC agent entity configuration file. This file is loaded to the server, and passed to omcli utility to configure
208-
the agent.
209-
210-
#### `variables.tf`
211-
Defines the variables used in the configuration
212-
213-
#### `example.tfvars`
214-
Environment specific values passed into configuration.
215-
216-
217-
### Chef Stage and Monitor Instance
218-
219-
#### `main.tf`
220-
Defines the compute resource that is monitored by OMC
221-
222-
#### `provider.tf`
223-
Specifies and passes authentication details to the OCI TF provider
224-
225-
#### `variables.tf`
226-
Defines the variables used in the configuration
227-
228-
229-
#### `stage.tfvars`
230-
Environment specific values passed into configuration to create a staged OMC server. Once this instance is running, create
231-
a custom image via the console.
232-
233-
#### `monitor.tfvars`
234-
Environment specific values passed into configuration that is based on the staged custom image created by the stage.tfvars run.
235-
236-
#### `stage_and_monitor.tfvars`
237-
Environment specific values passed into configuration that performs a full install and configuration of the OMC agent on a new instance.
238-
239-
240-
#### `./cookbooks/omc`
241-
OMC install and configuration cookbook. See the cookbook readme for more details.
242-
243-
#### `./cookbooks/data-bags/users/omc.json`
244-
OMC user definition that the cookbook uses for OMC install. Update this file with the ssh public key to be created
245-
on the server for this user.
246-
247-
248-
249-
250-
1+
This example has been moved to [docs/solutions/omc_monitored_server/](https://github.com/oracle/terraform-provider-oci/tree/master/docs/solutions/omc_monitored_server/).

docs/solutions/chef/README.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# ___ ____ _ ____ _ _____
2+
# / _ \| _ \ / \ / ___| | | ____|
3+
# | | | | |_) | / _ \| | | | | _|
4+
# | |_| | _ < / ___ | |___| |___| |___
5+
# \___/|_| \_/_/ \_\____|_____|_____|
6+
***
7+
## Bootstrap an instance as a Chef node
8+
This example shows how to use Terraform to bootstrap an OCI instance as a Chef node, register it with an existing Chef server, and run a recipe. When the plan completes, you will have a running web server with content and the correct firewall configuration.
9+
10+
### Prerequisites
11+
12+
* `knife` must be installed and configured in your PATH. This allows the Chef node deletion to work properly when `terraform destroy` is called.
13+
* Access to a Chef server to upload the example_webserver recipe to.
14+
15+
### Using this example
16+
* Update env-vars with the required information. Most examples use the same set of environment variables so you only need to do this once.
17+
* Source env-vars
18+
* `$ . env-vars`
19+
* Update `variables.tf` with your instance options.
20+
* Upload the example Chef recipe and its dependencies to your Chef server.
21+
* `$ cd cookbooks/example_webserver`
22+
* `$ berks install`
23+
* `$ berks upload`
24+
* Run `terraform apply`.
25+
* Navigate to the public IP address (reported by Terraform, above) in your browser.
26+
27+
### Files in the configuration
28+
29+
#### `env-vars`
30+
Is used to export the environmental variables used in the configuration. These are usually authentication related, be sure to exclude this file from your version control system. It's typical to keep this file outside of the configuration.
31+
32+
Before you plan, apply, or destroy the configuration source the file -
33+
`$ . env-vars`
34+
35+
#### `compute.tf`
36+
Defines the compute resource. This demo connects to the running instance
37+
so you will need to supply public/private keys to create an ssh connection.
38+
**NOTE**: do not try to use your api keys, see [this doc](https://docs.us-phoenix-1.oraclecloud.com/Content/Compute/Tasks/managingkeypairs.htm)
39+
for more info on configuring keys.
40+
41+
#### `./userdata/bootstrap`
42+
The user-data script that gets injected into the instance on launch. More information on user-data scripts can be [found at the cloud-init project.](https://cloudinit.readthedocs.io/en/latest/topics/format.html)
43+
44+
#### `variables.tf`
45+
Defines the variables used in the configuration
46+
47+
#### `datasources.tf`
48+
Defines the datasources used in the configuration
49+
50+
#### `outputs.tf`
51+
Defines the outputs of the configuration
52+
53+
#### `provider.tf`
54+
Specifies and passes authentication details to the OCI TF provider
55+
56+
#### `./cookbooks/example_webserver/recipes/default.rb`
57+
Installs a web server and configures the firewall to allow inbound http and ssh connections.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)