Skip to content

Commit

Permalink
chore: update p4_configure.sh and module configs for Helix Core
Browse files Browse the repository at this point in the history
Updated the p4_configure.sh script to include a new function that appends
the newly mounted EBS volumes or FSx mount points to the /etc/fstab file.
This ensures the mounts persist across reboots.

Also made some minor updates to the Terraform module configurations for
the Helix Core resources to align with the script changes.
  • Loading branch information
GrzesiekO committed Jul 26, 2024
1 parent 9a6bd23 commit 01fa081
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
12 changes: 11 additions & 1 deletion assets/packer/perforce/helix-core/p4_configure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -158,14 +158,24 @@ perform_operations() {
mount_fs_or_ebs() {
local mount_point=$1
local dest_dir=$2
local mount_options=""
local fs_type=""

if is_fsx_mount "$mount_point"; then
# Mount as FSx
mount -t nfs -o nconnect=16,rsize=1048576,wsize=1048576,timeo=600 "$mount_point" "$dest_dir"
mount_options="nfs nconnect=16,rsize=1048576,wsize=1048576,timeo=600"
fs_type="nfs"
else
# Mount as EBS the called function also creates XFS on EBS

prepare_ebs_volume "$mount_point" "$dest_dir"

mount_options="defaults"
fs_type="xfs"

fi
# Adding appending to the fstab so mounts persist across reboots.
echo "$mount_point $dest_dir $fs_type $mount_options 0 0" >> /etc/fstab
}

# Create temporary directories and mount
Expand Down
4 changes: 2 additions & 2 deletions modules/perforce/helix-core/data.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ data "aws_subnet" "instance_subnet" {
# Fetching custom Perforce Helix Core AMI
data "aws_ami" "helix_core_ami" {
most_recent = true
name_regex = "p4_rocky_linux-*"
name_regex = "p4_al2023-*"
owners = ["self"]

filter {
name = "name"
values = ["p4_rocky_linux-*"]
values = ["p4_al2023-*"]
}

filter {
Expand Down
2 changes: 1 addition & 1 deletion modules/perforce/helix-core/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ resource "aws_instance" "helix_core_instance" {

user_data = <<-EOT
#!/bin/bash
/home/rocky/p4_configure.sh /dev/sdf /dev/sdg /dev/sdh \
/home/ec2-user/gpic_scripts/p4_configure.sh /dev/sdf /dev/sdg /dev/sdh \
${var.server_type} \
${var.helix_core_super_user_username_secret_arn == null ? awscc_secretsmanager_secret.helix_core_super_user_username[0].secret_id : var.helix_core_super_user_username_secret_arn} \
${var.helix_core_super_user_password_secret_arn == null ? awscc_secretsmanager_secret.helix_core_super_user_password[0].secret_id : var.helix_core_super_user_password_secret_arn} \
Expand Down

0 comments on commit 01fa081

Please sign in to comment.