Skip to content

Commit

Permalink
Repl agent setup in example
Browse files Browse the repository at this point in the history
  • Loading branch information
krystian-panek-vmltech committed Nov 6, 2023
1 parent eaef064 commit 1d50111
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 12 deletions.
28 changes: 18 additions & 10 deletions examples/ssh/aem.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,26 @@ resource "aem_instance" "single" {
}
compose {
version = "1.5.8"
data_dir = local.aem_data_dir
data_dir = local.aem_single_compose_dir
}
hook {
bootstrap = <<EOF
#!/bin/sh
(
echo "Mounting EBS volume into data directory"
sudo mkfs -t ext4 ${local.aem_data_device} && \
sudo mkdir -p ${local.aem_data_dir} && \
sudo mount ${local.aem_data_device} ${local.aem_data_dir} && \
sudo chown -R ${local.ssh_user} ${local.aem_data_dir} && \
echo '${local.aem_data_device} ${local.aem_data_dir} ext4 defaults 0 0' | sudo tee -a /etc/fstab
sudo mkfs -t ext4 ${local.aem_single_data_device} && \
sudo mkdir -p ${local.aem_single_data_dir} && \
sudo mount ${local.aem_single_data_device} ${local.aem_single_data_dir} && \
sudo chown -R ${local.ssh_user} ${local.aem_single_data_dir} && \
echo '${local.aem_single_data_device} ${local.aem_single_data_dir} ext4 defaults 0 0' | sudo tee -a /etc/fstab
) && (
echo "Copying AEM library files"
sudo yum install -y unzip && \
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" && \
unzip -q awscliv2.zip && \
sudo ./aws/install --update && \
mkdir -p "${local.aem_data_dir}/aem/home/lib" && \
aws s3 cp --recursive --no-progress "s3://aemc/instance/classic/" "${local.aem_data_dir}/aem/home/lib"
mkdir -p "${local.aem_single_compose_dir}/aem/home/lib" && \
aws s3 cp --recursive --no-progress "s3://aemc/instance/classic/" "${local.aem_single_compose_dir}/aem/home/lib"
)
EOF
initialize = <<EOF
Expand All @@ -42,15 +42,23 @@ resource "aem_instance" "single" {
#!/bin/sh
sh aemw osgi bundle install --url "https://github.com/neva-dev/felix-search-webconsole-plugin/releases/download/2.0.0/search-webconsole-plugin-2.0.0.jar" && \
sh aemw osgi config save --pid "org.apache.sling.jcr.davex.impl.servlets.SlingDavExServlet" --input-string "alias: /crx/server" && \
echo "
enabled: true
transportUri: http://localhost:4503/bin/receive?sling:authRequestLogin=1
transportUser: admin
transportPassword: admin
userId: admin
" | sh aemw repl agent setup -A --location "author" --name "publish" && \
sh aemw package deploy --file "aem/home/lib/aem-service-pkg-6.5.*.0.zip"
EOF
}
}

locals {
// https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/device_naming.html#device-name-limits
aem_data_device = "/dev/nvme1n1"
aem_data_dir = "/data"
aem_single_data_device = "/dev/nvme1n1"
aem_single_data_dir = "/data"
aem_single_compose_dir = "${local.aem_single_data_dir}/aemc"
}

output "aem_instances" {
Expand Down
4 changes: 2 additions & 2 deletions internal/provider/instance_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ func (r *InstanceResource) createOrUpdate(ctx context.Context, plan *tfsdk.Plan,

status, err := ic.ReadStatus()
if err != nil {
diags.AddError("Unable to read AEM instance data", fmt.Sprintf("%s", err))
diags.AddError("Unable to read AEM instance status", fmt.Sprintf("%s", err))
return
}

Expand Down Expand Up @@ -350,7 +350,7 @@ func (r *InstanceResource) Read(ctx context.Context, req resource.ReadRequest, r

status, err := ic.ReadStatus()
if err != nil { //
resp.Diagnostics.AddError("Unable to read AEM instance data", fmt.Sprintf("%s", err))
resp.Diagnostics.AddError("Unable to read AEM instance status", fmt.Sprintf("%s", err))
return
}

Expand Down

0 comments on commit 1d50111

Please sign in to comment.