Skip to content

Commit d7f527d

Browse files
committed
modified: datasources.tf
modified: main.tf new file: modules/.DS_Store modified: modules/transcoder/main.tf modified: userdata/api/Dockerfile modified: userdata/scheduler/Dockerfile modified: userdata/scripts/cli_config.sh modified: userdata/scripts/create_db.sh modified: userdata/scripts/install_docker.sh modified: userdata/scripts/install_kubectl.sh modified: userdata/scripts/push_to_registry.sh modified: userdata/transcoder/Dockerfile modified: variables.tf
1 parent 09025e7 commit d7f527d

File tree

13 files changed

+58
-65
lines changed

13 files changed

+58
-65
lines changed

datasources.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ resource "random_string" "deploy_id" {
3535
}
3636

3737
# OEL Image lookup
38-
data "oci_core_images" "oraclelinux7" {
38+
data "oci_core_images" "oraclelinux8" {
3939
compartment_id = var.compartment_ocid
4040
operating_system = "Oracle Linux"
41-
operating_system_version = "7.9"
41+
operating_system_version = "8"
4242
shape = var.oke_nodepool_shape
4343
# filter {
4444
# name = "display_name"

main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ module "oke" {
5757
oke_node_memory = var.oke_node_memory
5858
cluster_options_add_ons_is_kubernetes_dashboard_enabled = var.cluster_options_add_ons_is_kubernetes_dashboard_enabled
5959
cluster_options_admission_controller_options_is_pod_security_policy_enabled = var.cluster_options_admission_controller_options_is_pod_security_policy_enabled
60-
image_id = data.oci_core_images.oraclelinux7.images.0.id
60+
image_id = data.oci_core_images.oraclelinux8.images.0.id
6161
vcn_id = var.useExistingVcn ? var.myVcn : module.network.vcn-id
6262
subnet_id = var.useExistingVcn ? var.OKESubnet : local.is_oke_public
6363
lb_subnet_id = module.network.edge-id
@@ -72,7 +72,7 @@ module "stg-server" {
7272
compartment_ocid = var.compartment_ocid
7373
# availability_domain = data.oci_identity_availability_domain.ad.name
7474
availability_domain = var.availability_domain
75-
image_id = data.oci_core_images.oraclelinux7.images.0.id
75+
image_id = data.oci_core_images.oraclelinux8.images.0.id
7676
# instance_shape = var.stg_server_shape
7777
instance_shape = var.oke_nodepool_shape == "VM.Standard.A1.Flex" ? "VM.Standard.A1.Flex" : var.stg_server_shape
7878
instance_name = var.stg_server_name

modules/.DS_Store

6 KB
Binary file not shown.

modules/transcoder/main.tf

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ resource null_resource "install_oci_cli" {
1717

1818
provisioner "file" {
1919
content = data.template_file.install_oci_cli.rendered
20-
destination = "~/cli_config.sh"
20+
destination = "/home/opc/cli_config.sh"
2121
}
2222

2323
provisioner "remote-exec" {
@@ -62,7 +62,7 @@ resource "null_resource" "create_db" {
6262

6363
provisioner "file" {
6464
content = data.template_file.create_db.rendered
65-
destination = "~/transcoder/build/create_db.sh"
65+
destination = "/home/opc/transcoder/build/create_db.sh"
6666
}
6767

6868
provisioner "remote-exec" {
@@ -97,7 +97,7 @@ resource "null_resource" "install_kubectl" {
9797

9898
provisioner "file" {
9999
content = data.template_file.install_kubectl.rendered
100-
destination = "~/install_kubectl.sh"
100+
destination = "/home/opc/install_kubectl.sh"
101101
}
102102

103103
provisioner "remote-exec" {
@@ -133,7 +133,7 @@ resource "null_resource" "generate_kubeconfig" {
133133

134134
provisioner "file" {
135135
content = data.template_file.generate_kubeconfig.rendered
136-
destination = "~/generate_kubeconfig.sh"
136+
destination = "/home/opc/generate_kubeconfig.sh"
137137
}
138138

139139
provisioner "remote-exec" {
@@ -168,7 +168,7 @@ resource "null_resource" "node_lifecycle" {
168168

169169
provisioner "file" {
170170
content = data.template_file.check_node_lifecycle.rendered
171-
destination = "~/is_worker_active.sh"
171+
destination = "/home/opc/is_worker_active.sh"
172172
}
173173

174174
provisioner "remote-exec" {
@@ -201,7 +201,7 @@ resource "null_resource" "install_docker" {
201201

202202
provisioner "file" {
203203
content = data.template_file.install_docker.rendered
204-
destination = "~/install_docker.sh"
204+
destination = "/home/opc/install_docker.sh"
205205
}
206206

207207
provisioner "remote-exec" {
@@ -250,17 +250,17 @@ resource "null_resource" "build_scheduler_docker_image" {
250250

251251
provisioner "file" {
252252
content = data.template_file.scheduler_dockerfile.rendered
253-
destination = "~/transcoder/scheduler/Dockerfile"
253+
destination = "/home/opc/transcoder/scheduler/Dockerfile"
254254
}
255255

256256
provisioner "file" {
257257
content = data.template_file.consumer.rendered
258-
destination = "~/transcoder/scheduler/consumer.py"
258+
destination = "/home/opc/transcoder/scheduler/consumer.py"
259259
}
260260

261261
provisioner "file" {
262262
content = data.template_file.new_job.rendered
263-
destination = "~/transcoder/scheduler/new_job.py"
263+
destination = "/home/opc/transcoder/scheduler/new_job.py"
264264
}
265265

266266
provisioner "remote-exec" {
@@ -302,12 +302,12 @@ resource "null_resource" "build_transcoder_docker_image" {
302302

303303
provisioner "file" {
304304
content = data.template_file.transcoder_dockerfile.rendered
305-
destination = "~/transcoder/transcode/Dockerfile"
305+
destination = "/home/opc/transcoder/transcode/Dockerfile"
306306
}
307307

308308
provisioner "file" {
309309
content = data.template_file.transcode.rendered
310-
destination = "~/transcoder/transcode/transcode.sh"
310+
destination = "/home/opc/transcoder/transcode/transcode.sh"
311311
}
312312

313313
provisioner "remote-exec" {
@@ -354,17 +354,17 @@ resource "null_resource" "build_api_docker_image" {
354354

355355
provisioner "file" {
356356
content = data.template_file.api_dockerfile.rendered
357-
destination = "~/transcoder/api/Dockerfile"
357+
destination = "/home/opc/transcoder/api/Dockerfile"
358358
}
359359

360360
provisioner "file" {
361361
content = data.template_file.api_bootstrap.rendered
362-
destination = "~/transcoder/api/bootstrap.sh"
362+
destination = "/home/opc/transcoder/api/bootstrap.sh"
363363
}
364364

365365
provisioner "file" {
366366
content = data.template_file.api_index.rendered
367-
destination = "~/transcoder/api/index.py"
367+
destination = "/home/opc/transcoder/api/index.py"
368368
}
369369

370370
provisioner "remote-exec" {
@@ -404,17 +404,17 @@ resource "null_resource" "build_nginx_docker_image" {
404404

405405
provisioner "file" {
406406
content = data.template_file.nginx_dockerfile.rendered
407-
destination = "~/transcoder/nginx/Dockerfile"
407+
destination = "/home/opc/transcoder/nginx/Dockerfile"
408408
}
409409

410410
provisioner "file" {
411411
content = data.template_file.nginx_conf.rendered
412-
destination = "~/transcoder/nginx/nginx.conf"
412+
destination = "/home/opc/transcoder/nginx/nginx.conf"
413413
}
414414

415415
provisioner "file" {
416416
source = "${path.module}/../../userdata/js"
417-
destination = "~/transcoder/nginx"
417+
destination = "/home/opc/transcoder/nginx"
418418
}
419419

420420
provisioner "remote-exec" {
@@ -433,7 +433,7 @@ data "template_file" "push_to_registry" {
433433
registry = var.registry
434434
repo_name = var.repo_name
435435
registry_user = var.registry_user
436-
tenancy_name = data.oci_identity_tenancy.my_tenancy.name
436+
os_namespace = data.oci_objectstorage_namespace.lookup.namespace
437437
region = var.region
438438
image_label = var.image_label
439439
}
@@ -452,7 +452,7 @@ resource "null_resource" "push_to_registry" {
452452

453453
provisioner "file" {
454454
content = data.template_file.push_to_registry.rendered
455-
destination = "~/transcoder/build/push_to_registry.sh"
455+
destination = "/home/opc/transcoder/build/push_to_registry.sh"
456456
}
457457

458458
provisioner "remote-exec" {
@@ -499,7 +499,7 @@ resource "null_resource" "cluster_autoscaler" {
499499

500500
provisioner "file" {
501501
content = data.template_file.cluster_autoscaler_template.rendered
502-
destination = "~/transcoder/build/cluster-autoscaler.yaml"
502+
destination = "/home/opc/transcoder/build/cluster-autoscaler.yaml"
503503
}
504504

505505
provisioner "remote-exec" {
@@ -618,32 +618,32 @@ resource "null_resource" "deploy_containers" {
618618

619619
provisioner "file" {
620620
content = data.template_file.configmap_template.rendered
621-
destination = "~/transcoder/build/configmap.yaml"
621+
destination = "/home/opc/transcoder/build/configmap.yaml"
622622
}
623623

624624
provisioner "file" {
625625
content = data.template_file.scheduler_template.rendered
626-
destination = "~/transcoder/build/scheduler.yaml"
626+
destination = "/home/opc/transcoder/build/scheduler.yaml"
627627
}
628628

629629
provisioner "file" {
630630
content = data.template_file.api_server_template.rendered
631-
destination = "~/transcoder/build/api-server.yaml"
631+
destination = "/home/opc/transcoder/build/api-server.yaml"
632632
}
633633

634634
provisioner "file" {
635635
content = data.template_file.db_secret_template.rendered
636-
destination = "~/transcoder/build/db-secret.yaml"
636+
destination = "/home/opc/transcoder/build/db-secret.yaml"
637637
}
638638

639639
provisioner "file" {
640640
content = data.template_file.deploy.rendered
641-
destination = "~/transcoder/build/deploy.sh"
641+
destination = "/home/opc/transcoder/build/deploy.sh"
642642
}
643643

644644
provisioner "file" {
645645
content = data.template_file.generate_admin_password.rendered
646-
destination = "~/transcoder/build/generate_admin_password.py"
646+
destination = "/home/opc/transcoder/build/generate_admin_password.py"
647647
}
648648

649649
provisioner "remote-exec" {

userdata/api/Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM python:3.9-slim-buster
1+
FROM python:3.11-slim
22

33
# Installing packages
44
RUN pip install flask
@@ -8,9 +8,9 @@ RUN pip install werkzeug
88
RUN pip install pymysql
99
RUN pip install kubernetes
1010
RUN pip install oci
11-
RUN pip install putz
11+
RUN pip install pytz
1212

13-
RUN apt -y update && apt -y install build-essential python-dev
13+
RUN apt -y update && apt -y install build-essential python-dev-is-python3
1414
RUN pip install uwsgi
1515

1616
# Defining working directory and adding source code

userdata/scheduler/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM python:3.9-slim-buster
1+
FROM python:3.11-slim
22

33
RUN pip install oci
44
RUN pip install kubernetes

userdata/scripts/cli_config.sh

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
#!/bin/bash
22

3-
#curl -L -O https://raw.githubusercontent.com/oracle/oci-cli/master/scripts/install/install.sh && chmod a+x install.sh && ./install.sh --accept-all-defaults
4-
5-
sudo yum install python36-oci-cli
3+
sudo dnf -y install oraclelinux-developer-release-el8
4+
sudo dnf -y install python36-oci-cli
65

76
echo "export OCI_CLI_AUTH=instance_principal" >> ~/.bash_profile
8-
echo "export OCI_CLI_AUTH=instance_principal" >> ~/.bashrc
7+
echo "export OCI_CLI_AUTH=instance_principal" >> ~/.bashrc

userdata/scripts/create_db.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ sudo yum install -y mysql
77

88
# Connect to MySQL instance and create transcoding database and user
99
mysql -h ${db_ip} -u ${admin_db_user} -p${admin_db_password} -e "CREATE DATABASE IF NOT EXISTS ${db_name} CHARACTER SET utf8 COLLATE utf8_unicode_ci;;"
10-
mysql -h ${db_ip} -u ${admin_db_user} -p${admin_db_password} -e "CREATE USER IF NOT EXISTS ${db_user} IDENTIFIED WITH mysql_native_password BY '${db_password}'"
10+
mysql -h ${db_ip} -u ${admin_db_user} -p${admin_db_password} -e "CREATE USER IF NOT EXISTS ${db_user} IDENTIFIED BY '${db_password}'"
1111
mysql -h ${db_ip} -u ${admin_db_user} -p${admin_db_password} -e "GRANT ALL ON ${db_name}.* TO ${db_user}"
1212

1313
# Create jobs table

userdata/scripts/install_docker.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
#!/bin/bash
22

33
# Install docker
4-
sudo yum-config-manager --enable ol7_addons
5-
sudo yum install -y docker-engine docker-cli
4+
sudo dnf install -y dnf-utils
5+
sudo dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
6+
7+
sudo dnf install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y
68

79

810
# Enable and start docker daemon
9-
sudo systemctl enable docker
10-
sudo systemctl start docker
11+
sudo systemctl enable --now docker
12+
#sudo systemctl start docker
1113

1214
# Add user to docker group
1315
sudo usermod -a -G docker ${user}

userdata/scripts/install_kubectl.sh

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,8 @@
22
# Copyright 2017, 2019, Oracle Corporation and/or affiliates. All rights reserved.
33
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl
44

5-
#sudo yum install -y oracle-olcne-release-el7
5+
sudo dnf -y install oracle-olcne-release-el8
6+
sudo dnf config-manager --enable ol8_olcne19
7+
sudo dnf -y install kubectl
68

7-
#sudo yum-config-manager --enable ol7_olcne
8-
9-
sudo yum install -y kubectl git
10-
11-
#curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/${cpu_arch}/kubectl"
12-
#sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
13-
14-
mkdir -p ~/.kube
15-
16-
#echo "source <(kubectl completion bash)" >> ~/.bashrc
179
echo "alias k='kubectl'" >> ~/.bashrc

0 commit comments

Comments
 (0)