Skip to content

Commit

Permalink
AWS Lightsail support (#488)
Browse files Browse the repository at this point in the history
* Docs for AWS

* Disable shellcheck for windows

* Add lightsail deployment (TODO)

* fmt

* Fix shellcheck

* Shellcheck fix

* bump

* Go 1.18

* Bump
  • Loading branch information
Amet13 authored Apr 4, 2022
1 parent 33e0d0e commit ee21dbd
Show file tree
Hide file tree
Showing 8 changed files with 91 additions and 2 deletions.
6 changes: 6 additions & 0 deletions docs/advanced-docs/terraform/aws_lightsail.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# AWS Lightsail

{%
include "../../../terraform/aws_lightsail/README.md"
start="# AWS Lightsail deployment"
%}
24 changes: 24 additions & 0 deletions terraform/aws_lightsail/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# AWS Lightsail deployment

## Requirements

- AWS account
- `terraform` (1.0+) installed

## Deploy

To deploy:

```sh
terraform init
terraform plan
terraform apply
```

## Destroy

To destroy:

```sh
terraform destroy
```
18 changes: 18 additions & 0 deletions terraform/aws_lightsail/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
resource "awslightsail_container_service" "service" {
name = "${var.app}-service"
power = var.power
scale = var.scale
}

resource "awslightsail_container_deployment" "deployment" {
container_service_name = awslightsail_container_service.service.id
container {
container_name = "${var.app}-deployment"
image = var.image

environment {
key = "ENABLE_PRIMITIVE"
value = "false"
}
}
}
13 changes: 13 additions & 0 deletions terraform/aws_lightsail/provider.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
terraform {
required_providers {
awslightsail = {
source = "DeYoungTech/awslightsail"
version = "0.7.0"
}
}
required_version = "~> 1.0"
}

provider "awslightsail" {
region = var.region_name
}
3 changes: 3 additions & 0 deletions terraform/aws_lightsail/terraform.tfvars
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
scale = 1
power = "medium"
region_name = "eu-central-1"
25 changes: 25 additions & 0 deletions terraform/aws_lightsail/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
variable "app" {
type = string
default = "db1000n"
}

variable "image" {
type = string
default = "ghcr.io/arriven/db1000n:latest"
}

variable "scale" {
type = number
default = 1
}

# https://lightsail.aws.amazon.com/ls/docs/en_us/articles/amazon-lightsail-creating-container-services#create-container-service-capacity
variable "power" {
type = string
default = "medium"
}

variable "region_name" {
type = string
default = "eu-central-1"
}
2 changes: 1 addition & 1 deletion terraform/heroku/terraform.tfvars
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Latest release: https://github.com/Arriven/db1000n/releases/latest
app_version = "0.8.15"
app_version = "0.8.17"

# If you want to use more that 1 instance and larger instance type
# make sure that your Credit Card is attached to the account
Expand Down
2 changes: 1 addition & 1 deletion terraform/hetzner_cloud/user_data.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#cloud-config
runcmd:
# replace with the latest version
- wget -c https://github.com/Arriven/db1000n/releases/download/v0.8.15/db1000n-v0.8.15-linux-amd64.tar.gz -O - | tar -xz
- wget -c https://github.com/Arriven/db1000n/releases/download/v0.8.17/db1000n-v0.8.17-linux-amd64.tar.gz -O - | tar -xz
- systemctl daemon-reload
- systemctl enable db1000n
- systemctl start db1000n
Expand Down

0 comments on commit ee21dbd

Please sign in to comment.