Skip to content

Commit 82dc23f

Browse files
authored
Data docs (#1418)
1 parent 2123430 commit 82dc23f

File tree

36 files changed

+734
-253
lines changed

36 files changed

+734
-253
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.terraform
2+
*.lock.hcl
3+
*.tfstate
4+
*.tfstate.backup

packages/pgml-rds-proxy/ec2/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Terraform configuration for pgml-rds-proxy on EC2
2+
3+
This is a sample Terraform deployment for running pgml-rds-proxy on EC2. This will spin up an EC2 instance
4+
with a public IP and a working security group & install the community Docker runtime.
5+
6+
Once the instance is running, you can connect to it using the root key and run the pgml-rds-proxy Docker container
7+
with the correct PostgresML `DATABASE_URL`.
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
terraform {
2+
required_providers {
3+
aws = {
4+
source = "hashicorp/aws"
5+
version = "~> 5.46"
6+
}
7+
}
8+
9+
required_version = ">= 1.2.0"
10+
}
11+
12+
provider "aws" {
13+
region = "us-west-2"
14+
}
15+
16+
data "aws_ami" "ubuntu" {
17+
most_recent = true
18+
19+
filter {
20+
name = "name"
21+
values = ["ubuntu/images/hvm-ssd/ubuntu-jammy-22.04-amd64-server-*"]
22+
}
23+
24+
filter {
25+
name = "virtualization-type"
26+
values = ["hvm"]
27+
}
28+
29+
owners = ["099720109477"] # Canonical
30+
}
31+
32+
resource "aws_security_group" "pgml-rds-proxy" {
33+
egress {
34+
from_port = 0
35+
to_port = 0
36+
protocol = "-1"
37+
cidr_blocks = ["0.0.0.0/0"]
38+
ipv6_cidr_blocks = ["::/0"]
39+
}
40+
41+
ingress {
42+
from_port = 6432
43+
to_port = 6432
44+
protocol = "tcp"
45+
cidr_blocks = ["0.0.0.0/0"]
46+
ipv6_cidr_blocks = ["::/0"]
47+
}
48+
49+
ingress {
50+
from_port = 22
51+
to_port = 22
52+
protocol = "tcp"
53+
cidr_blocks = ["0.0.0.0/0"]
54+
ipv6_cidr_blocks = ["::/0"]
55+
}
56+
}
57+
58+
resource "aws_instance" "pgml-rds-proxy" {
59+
ami = data.aws_ami.ubuntu.id
60+
instance_type = "t3.micro"
61+
key_name = var.root_key
62+
63+
root_block_device {
64+
volume_size = 30
65+
delete_on_termination = true
66+
}
67+
68+
vpc_security_group_ids = [
69+
"${aws_security_group.pgml-rds-proxy.id}",
70+
]
71+
72+
associate_public_ip_address = true
73+
user_data = file("${path.module}/user_data.sh")
74+
user_data_replace_on_change = false
75+
76+
tags = {
77+
Name = "pgml-rds-proxy"
78+
}
79+
}
80+
81+
variable "root_key" {
82+
type = string
83+
description = "The name of the SSH Root Key you'd like to assign to this EC2 instance. Make sure it's a key you have access to."
84+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
#
3+
# Cloud init script to install Docker on an EC2 instance running Ubuntu 22.04.
4+
#
5+
6+
sudo apt-get update
7+
sudo apt-get install ca-certificates curl
8+
sudo install -m 0755 -d /etc/apt/keyrings
9+
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
10+
sudo chmod a+r /etc/apt/keyrings/docker.asc
11+
12+
# Add the repository to Apt sources:
13+
echo \
14+
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
15+
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
16+
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
17+
sudo apt-get update
18+
19+
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
20+
sudo groupadd docker
21+
sudo usermod -aG docker ubuntu

pgml-cms/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.md.bak
42.5 KB
Loading
479 KB
Loading
31.2 KB
Loading
33.1 KB
Loading
57.1 KB
Loading

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy