Skip to content

Commit

Permalink
Merge pull request #830 from NOAA-OWP/data-ingest-fix
Browse files Browse the repository at this point in the history
When the Linux Image Builder Pipeline was updated and fixed, the resulting new AMI broke the startup script for the Data Ingest EC2s. This is because the new AMI has a newer version of Docker, which handles the COPY commands in the Dockerfiles differently due to now using BuildKit in the Docker build process.

To fix this, I added an environment variable to disable buildkit.

Removed custom Rysylog install from the Linux Image Builder pipeline and updated rsyslog config to work with the older version of rsyslog already installed in the base AMI.

Updated Terraform block to work with new version of Terraform.
  • Loading branch information
nickchadwick-noaa authored Aug 19, 2024
2 parents df4d841 + 74043a7 commit 856dc4b
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 25 deletions.
8 changes: 8 additions & 0 deletions Core/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Core/EC2/Ingest/templates/prc_install.sh.tftpl
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ echo "Setting up HML Ingester Environment"
(echo "${r_host}"; echo "${r_password}"; echo "${db_host}"; echo "${db_password}") | sudo ./update_configs.sh hydrovis.${environment}

echo "Building HML Ingester Docker"
sudo docker-compose -f docker-compose_hydrovis_${environment}.yml up --build -d
sudo DOCKER_BUILDKIT=0 docker-compose -f docker-compose_hydrovis_${environment}.yml up --build -d

echo "Finished Setup"
26 changes: 3 additions & 23 deletions Core/ImageBuilder/Pipelines/linux/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -213,28 +213,6 @@ resource "aws_imagebuilder_component" "logging_setup" {
{
name = "build"
steps = [
{
name = "upgrade_rsyslog"
action = "ExecuteBash"
inputs = {
commands = [
"echo \"Upgrading Rsyslog\"",
<<-EOT
sudo tee /etc/yum.repos.d/rsyslog-daily-epel.repo<<EOF
[rsyslog_v8_daily]
name=Adiscon CentOS-7 - daily packages for x86_64
baseurl=http://rpms.adiscon.com/v8-stable-daily/epel-7/x86_64
enabled=1
gpgcheck=0
gpgkey=https://rpms.adiscon.com/RPM-GPG-KEY-Adiscon
protect=1
EOF
EOT
,
"yum upgrade rsyslog --disablerepo=amzn2-core -y",
]
}
},
{
name = "add_docker_log_driver"
action = "ExecuteBash"
Expand Down Expand Up @@ -262,12 +240,14 @@ resource "aws_imagebuilder_component" "logging_setup" {
echo "Adding Rsyslog Destination Config"
sudo tee /etc/rsyslog.d/01-docker-logs.conf<<'EOF'
set $.app_name=getenv("HYDROVIS_APPLICATION");
template(name="dockerjson" type="list") {
constant(value="{")
constant(value="\"@timestamp\":\"") property(name="timereported" dateFormat="rfc3339")
constant(value="\",\"host\":\"") property(name="hostname")
constant(value="\",\"programname\":\"") property(name="programname")
constant(value="\",\"application\":\"") constant(value=`echo $HYDROVIS_APPLICATION`)
constant(value="\",\"application\":\"") property(name="$.app_name")
constant(value="\",\"container_name\":\"") property(name="syslogtag" regex.type="ERE" regex.submatch="1" regex.expression="docker\\/(.+)\\[[0-9]+]")
constant(value="\",\"message\":\"") property(name="msg" format="json")
constant(value="\"}\n")
Expand Down
2 changes: 1 addition & 1 deletion Core/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ terraform {
key = "state"
region = "us-east-1"
profile = "prod"
shared_credentials_file = "/cloud/aws/credentials"
shared_credentials_files = ["/cloud/aws/credentials"]
}
}

Expand Down

0 comments on commit 856dc4b

Please sign in to comment.