mirror of
https://github.com/idanoo/fediservices.nz-infra
synced 2025-07-01 05:42:14 +00:00
Use docker-compose
This commit is contained in:
parent
bced107145
commit
97039f07e7
5 changed files with 39 additions and 10 deletions
4
ec2.tf
4
ec2.tf
|
@ -10,7 +10,7 @@ resource "aws_instance" "instance" {
|
|||
key_name = var.ssh_key
|
||||
vpc_security_group_ids = [aws_security_group.sg.id]
|
||||
|
||||
tags = { Name = "status.fediservices.nz" }
|
||||
tags = { Name = var.domain }
|
||||
|
||||
lifecycle {
|
||||
ignore_changes = [
|
||||
|
@ -24,7 +24,7 @@ resource "aws_eip" "eip" {
|
|||
instance = aws_instance.instance.id
|
||||
vpc = true
|
||||
|
||||
tags = { Name = "status.fediservices.nz" }
|
||||
tags = { Name = var.domain }
|
||||
}
|
||||
|
||||
# EBS Vol for persistance
|
||||
|
|
4
sg.tf
4
sg.tf
|
@ -1,7 +1,7 @@
|
|||
# Security groups to access database1.apse2
|
||||
resource "aws_security_group" "sg" {
|
||||
name = "status.fediservices.nz"
|
||||
description = "status.fediservices.nz"
|
||||
name = var.domain
|
||||
description = var.domain
|
||||
|
||||
vpc_id = aws_vpc.vpc.id
|
||||
}
|
||||
|
|
|
@ -6,5 +6,6 @@ data "template_file" "userdata" {
|
|||
region = data.aws_region.current.name
|
||||
data_root = "/data"
|
||||
volume = aws_ebs_volume.ebs.id
|
||||
domain = var.domain
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,11 +58,34 @@ sudo resize2fs /dev/$device
|
|||
sudo chown ubuntu:ubuntu -R ${data_root}
|
||||
|
||||
# Run it!
|
||||
docker run -d \
|
||||
--restart=always \
|
||||
-p 3001:3001 \
|
||||
-v ${data_root}/uptime-kuma:/app/data \
|
||||
--name uptime-kuma \
|
||||
louislam/uptime-kuma
|
||||
cat <<EOF > docker-compose.yml
|
||||
version: '3'
|
||||
networks:
|
||||
default:
|
||||
name: 'proxy_network'
|
||||
services:
|
||||
uptime-kuma:
|
||||
image: louislam/uptime-kuma:1
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- ${data_root}/uptime-kuma:/app/data
|
||||
labels:
|
||||
caddy: ${domain}
|
||||
caddy.reverse_proxy: "* {{ '{{upstreams 3001}}'}}"
|
||||
caddy:
|
||||
image: "lucaslorentz/caddy-docker-proxy:ci-alpine"
|
||||
ports:
|
||||
- "80:80"
|
||||
- "443:443"
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock:ro
|
||||
- ${data_root}/caddy_data:/data
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
- CADDY_INGRESS_NETWORKS=proxy_network
|
||||
|
||||
EOF
|
||||
|
||||
docker compose up -d
|
||||
|
||||
sudo snap start amazon-ssm-agent
|
|
@ -8,5 +8,10 @@ variable "instance_type" {
|
|||
default = "t4g.nano"
|
||||
}
|
||||
|
||||
variable "domain" {
|
||||
type = string
|
||||
default = "status.fediservices.nz"
|
||||
}
|
||||
|
||||
variable "AWS_ACCESS_KEY_ID" {}
|
||||
variable "AWS_SECRET_ACCESS_KEY" {}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue