mirror of
https://github.com/Hestia-Homes/survey-extraction.git
synced 2026-06-30 13:10:56 +00:00
db live production
This commit is contained in:
parent
1fd7e4ea1b
commit
c26de61789
6 changed files with 37 additions and 43 deletions
|
|
@ -1,5 +1,9 @@
|
|||
version: '3.8'
|
||||
|
||||
networks:
|
||||
survey-net:
|
||||
driver: bridge
|
||||
|
||||
services:
|
||||
survey-extractor:
|
||||
user: "${UID}:${GID}"
|
||||
|
|
@ -11,14 +15,13 @@ services:
|
|||
- ../.db-env
|
||||
volumes:
|
||||
- ..:/workspaces/survey-extractor:cached
|
||||
|
||||
depends_on:
|
||||
- db
|
||||
networks:
|
||||
- default
|
||||
- survey-net
|
||||
|
||||
db:
|
||||
image: postgres:latest
|
||||
image: postgres:17.4
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- 5432:5432
|
||||
|
|
@ -27,7 +30,7 @@ services:
|
|||
volumes:
|
||||
- postgres-data:/var/lib/postgresql/data
|
||||
networks:
|
||||
- default
|
||||
- survey-net
|
||||
|
||||
pgadmin:
|
||||
image: dpage/pgadmin4
|
||||
|
|
@ -37,13 +40,10 @@ services:
|
|||
env_file:
|
||||
- ../.db-env
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
- default
|
||||
depends_on:
|
||||
- db
|
||||
networks:
|
||||
- survey-net
|
||||
|
||||
volumes:
|
||||
postgres-data:
|
||||
|
||||
networks:
|
||||
default:
|
||||
|
|
|
|||
2
.github/workflows/teraform.yml
vendored
2
.github/workflows/teraform.yml
vendored
|
|
@ -19,7 +19,7 @@ jobs:
|
|||
|
||||
env:
|
||||
AWS_REGION: "eu-north-1"
|
||||
BUCKET_NAME: "survey-extractor-terraform-state"
|
||||
BUCKET_NAME: "survey-extractor-tf-state"
|
||||
|
||||
steps:
|
||||
- name: Checkout Code
|
||||
|
|
|
|||
|
|
@ -1,23 +1,14 @@
|
|||
resource "aws_db_instance" "default" {
|
||||
allocated_storage = var.allocated_storage
|
||||
engine = "postgres"
|
||||
engine_version = "14.10"
|
||||
engine_version = "17.4"
|
||||
instance_class = "db.t3.micro"
|
||||
db_name = "surveyDB"
|
||||
username = "postgres"
|
||||
password = "makingwarmhomes"
|
||||
publicly_accessible = true
|
||||
|
||||
vpc_security_group_ids = [aws_security_group.rds_sg.id]
|
||||
db_subnet_group_name = aws_db_subnet_group.my_db_subnet_group.name
|
||||
|
||||
skip_final_snapshot = true
|
||||
}
|
||||
|
||||
resource "aws_db_subnet_group" "my_db_subnet_group" {
|
||||
name = "my-db-subnet-group"
|
||||
subnet_ids = [aws_subnet.subnet_a.id, aws_subnet.subnet_b.id]
|
||||
|
||||
tags = {
|
||||
Name = "My DB Subnet Group"
|
||||
}
|
||||
}
|
||||
|
|
@ -6,8 +6,8 @@ terraform {
|
|||
}
|
||||
}
|
||||
backend "s3" {
|
||||
bucket = "survey-extractor-terraform-state"
|
||||
region = "eu-north-1"
|
||||
bucket = "survey-extractor-tf-state"
|
||||
region = "eu-west-2"
|
||||
profile = "domna.dev" # /home/vscode/aws/credentials
|
||||
key = "terraform.tfstate"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
variable region {
|
||||
type = string
|
||||
default = "eu-north-1"
|
||||
default = "eu-west-2"
|
||||
description = "AWS region"
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,29 +1,32 @@
|
|||
resource "aws_vpc" "my_vpc" {
|
||||
cidr_block = "10.0.0.0/16"
|
||||
data "aws_vpc" "default" {
|
||||
default = true
|
||||
}
|
||||
|
||||
resource "aws_subnet" "subnet_a" {
|
||||
vpc_id = aws_vpc.my_vpc.id
|
||||
cidr_block = "10.0.1.0/24"
|
||||
availability_zone = "eu-central-1a"
|
||||
}
|
||||
|
||||
resource "aws_subnet" "subnet_b" {
|
||||
vpc_id = aws_vpc.my_vpc.id
|
||||
cidr_block = "10.0.2.0/24"
|
||||
availability_zone = "eu-central-1b"
|
||||
}
|
||||
|
||||
resource "aws_security_group" "rds_sg" {
|
||||
name_prefix = "rds-"
|
||||
|
||||
vpc_id = aws_vpc.my_vpc.id
|
||||
|
||||
# Add any additional ingress/egress rules as needed
|
||||
description = "Allow TLS inbound traffic"
|
||||
vpc_id = data.aws_vpc.default.id
|
||||
|
||||
ingress {
|
||||
from_port = 3306
|
||||
to_port = 9000
|
||||
protocol = "tcp"
|
||||
# TLS (change to whatever ports you need)
|
||||
from_port = 5432
|
||||
to_port = 5432
|
||||
protocol = "tcp"
|
||||
cidr_blocks = ["0.0.0.0/0"]
|
||||
}
|
||||
}
|
||||
|
||||
egress {
|
||||
from_port = 0
|
||||
to_port = 0
|
||||
protocol = "-1"
|
||||
cidr_blocks = ["0.0.0.0/0"]
|
||||
}
|
||||
|
||||
lifecycle {
|
||||
create_before_destroy = true
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue