-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
1,030 additions
and
386 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
packer { | ||
required_plugins { | ||
amazon = { | ||
version = ">= 1.2.8" | ||
source = "github.com/hashicorp/amazon" | ||
} | ||
} | ||
} | ||
|
||
variable "deployment_name" { | ||
type = string | ||
} | ||
|
||
variable "ami_name" { | ||
type = string | ||
} | ||
|
||
variable "vpc_id" { | ||
type = string | ||
} | ||
|
||
variable "region" { | ||
type = string | ||
default = "eu-west-1" | ||
} | ||
|
||
variable "instance_type" { | ||
type = string | ||
default = "t2.micro" | ||
} | ||
|
||
variable "subnet_id" { | ||
type = string | ||
} | ||
|
||
variable "keycloak_version" { | ||
type = string | ||
default = "25.0.5" | ||
} | ||
|
||
variable "conf" { | ||
type = string | ||
} | ||
|
||
locals { | ||
conf_dest = "/opt/keycloak/conf/keycloak.conf" | ||
} | ||
|
||
source "amazon-ebs" "ubuntu" { | ||
ami_name = "${var.ami_name}" | ||
instance_type = "${var.instance_type}" | ||
region = "${var.region}" | ||
vpc_id = "${var.vpc_id}" | ||
subnet_id = "${var.subnet_id}" | ||
associate_public_ip_address = true | ||
tags = { | ||
veraison-deployment = "${var.deployment_name}" | ||
} | ||
source_ami_filter { | ||
filters = { | ||
name = "ubuntu/images/*ubuntu-jammy-22.04-amd64-server-*" | ||
root-device-type = "ebs" | ||
virtualization-type = "hvm" | ||
architecture = "x86_64" | ||
} | ||
owners = ["099720109477"] # amazon | ||
most_recent = true | ||
} | ||
ssh_username = "ubuntu" | ||
} | ||
|
||
build { | ||
name = "veraison-keycloak" | ||
sources = [ | ||
"source.amazon-ebs.ubuntu" | ||
] | ||
|
||
provisioner "file" { | ||
source = "${var.conf}" | ||
destination = "keycloak.conf" | ||
} | ||
|
||
provisioner "shell" { | ||
inline = [ | ||
"sleep 1", | ||
"sudo apt-get update", | ||
"sudo apt-get update", # doing it twice as once doesn't seem to be enough .... | ||
"sudo apt-get install -f --yes openjdk-21-jdk 2>&1", | ||
|
||
"sudo groupadd --system keycloak", | ||
"sudo useradd --system --gid keycloak --no-create-home --shell /bin/false keycloak", | ||
|
||
"wget https://github.com/keycloak/keycloak/releases/download/${var.keycloak_version}/keycloak-${var.keycloak_version}.tar.gz", | ||
"tar xf keycloak-${var.keycloak_version}.tar.gz", | ||
"rm keycloak-${var.keycloak_version}.tar.gz", | ||
"sudo mv keycloak-${var.keycloak_version} /opt/keycloak", | ||
"sudo mv keycloak.conf /opt/keycloak/conf/keycloak.conf", | ||
"sudo chown -R keycloak:keycloak /opt/keycloak" | ||
] | ||
} | ||
} | ||
|
||
# vim: set et sts=2 sw=2: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# See https://www.keycloak.org/server/all-config for all alvailable configuration. | ||
http-enabled=false | ||
https-port=${KEYCLOAK_PORT} | ||
hostname-strict=false | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.