Skip to content

Commit

Permalink
Merge pull request #15 from Ontotext-AD/amzn2-linux-support
Browse files Browse the repository at this point in the history
Added support for Amazon Linux 2
  • Loading branch information
simeonzhekofff authored Jun 3, 2024
2 parents 1e915bb + 54d116b commit c360bba
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 6 deletions.
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ packer_cache/
crash.log

# https://www.packer.io/guides/hcl/variables
# Exclude all .pkrvars.hcl files, which are likely to contain sensitive data,
# such as password, private keys, and other secrets. These should not be part of
# version control as they are data points which are potentially sensitive and
# Exclude all .pkrvars.hcl files, which are likely to contain sensitive data,
# such as password, private keys, and other secrets. These should not be part of
# version control as they are data points which are potentially sensitive and
# subject to change depending on the environment.
#
*.pkrvars.hcl
Expand Down
45 changes: 43 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Packer Configuration for Creating GraphDB AMI
# Packer Configuration for Creating GraphDB Ubuntu AMI

This guide explains how to use Packer to create an Amazon Machine Image (AMI) for GraphDB.
The Packer configuration in this repository automates the process of installing and configuring GraphDB on an Ubuntu-based EC2 instance.
Expand Down Expand Up @@ -35,7 +35,7 @@ Follow these steps to build an AMI for GraphDB using Packer:
The Packer configuration allows you to customize various parameters, such as the GraphDB version, AWS region,
instance type, VPC ID, and subnet ID. To do so, create a variables file `variables.pkrvars.hcl`, example file:
```bash
graphdb_version = "10.3.3"
graphdb_version = "10.6.3"
ami_regions = ["us-east-1"]
build_vpc_id = "<your-vpc-id>"
build_subnet_id = "<your-subnet-id>"
Expand Down Expand Up @@ -77,6 +77,47 @@ The following points can be customized in a packer variables file `variables.pkr
- **Provisioning Scripts**: You can replace or modify the provisioning scripts located in the `./files/` directory.
These scripts and files are copied and executed during the AMI creation process.

## Building an AMI based on Amazon Linux

This guide provides step-by-step instructions for building your own Amazon Linux AMI image.
Follow the instructions below to configure and build the image successfully.

### Step-by-Step Instructions

To build an AMI based on Amazon Linux you need to update the install_graphdb.sh script.
This script installs necessary tools and configures the environment. Follow these steps to modify the script:

1. Open the install_graphdb.sh script in a text editor.
2. Replace the existing content between lines 12-36 with the following code:

```bash
# Install Tools
yum update -y
yum install -y java-11-amazon-corretto
# Get the server architecture and corresponding AWS CLI
server_arch=$(uname -m)
if [[ "$server_arch" == "x86_64" ]]; then
curl "https://amazoncloudwatch-agent.s3.amazonaws.com/amazon_linux/amd64/latest/amazon-cloudwatch-agent.rpm" -o "amazon-cloudwatch-agent.rpm"
elif [[ "$server_arch" == "aarch64" ]]; then
curl "https://amazoncloudwatch-agent.s3.amazonaws.com/amazon_linux/arm64/latest/amazon-cloudwatch-agent.rpm" -o "amazon-cloudwatch-agent.rpm"
else
echo "Unknown server architecture: $server_arch."
exit 1
fi
yum install -y ./amazon-cloudwatch-agent.rpm
rm amazon-cloudwatch-agent.rpm
```

3. Update variables.pkrvars.hcl values for source_ami_name_filter_arm64 and source_ami_name_filter_x86_64 as shown below:

```hcl
source_ami_name_filter_arm64 = "amzn2-ami-hvm-*-arm64-gp2"
source_ami_name_filter_x86_64 = "amzn2-ami-hvm-*-x86_64-gp2"
```

## Support

For questions or issues related to this Packer configuration, please [submit an issue](https://github.com/Ontotext-AD/packer-aws-graphdb/issues).
2 changes: 1 addition & 1 deletion variables.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
variable "graphdb_version" {
description = "GraphDB version to install and package as an AMI"
type = string
default = "10.6.1"
default = "10.6.3"
}

####################
Expand Down

0 comments on commit c360bba

Please sign in to comment.