-
Notifications
You must be signed in to change notification settings - Fork 11
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
16 changed files
with
233 additions
and
38 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,5 +1 @@ | ||
vultr | ||
# Host vultr | ||
# HostName 45.77.172.10 | ||
# User root | ||
# IdentityFile ~/.ssh/qwe.pem | ||
aws |
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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
node_modules | ||
.eslintrc.cjs | ||
.eslintrc.cjs | ||
.history |
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,27 @@ | ||
resource "aws_route53_zone" "main" { | ||
name = var.domain_name | ||
} | ||
|
||
resource "aws_eip" "lb" { | ||
instance = aws_instance.app_server.id | ||
domain = "vpc" | ||
} | ||
|
||
resource "aws_route53_record" "chat" { | ||
zone_id = aws_route53_zone.main.zone_id | ||
name = var.domain_name | ||
# records = [aws_instance.app_server.public_dns] | ||
records = [aws_eip.lb.public_ip] | ||
ttl = 600 | ||
type = "A" | ||
} | ||
|
||
# resource "aws_route53_record" "ns" { | ||
# allow_overwrite = true | ||
# name = var.domain_name | ||
# ttl = 172800 | ||
# type = "NS" | ||
# zone_id = aws_route53_zone.main.zone_id | ||
|
||
# records = aws_route53_zone.main.name_servers | ||
# } |
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,10 @@ | ||
resource "aws_instance" "app_server" { | ||
# ami = "ami-09dac21d1664bc313" # official one | ||
ami = "ami-0ce99c18a68a1b23b" # customized one | ||
instance_type = "t2.micro" | ||
key_name = var.key_name | ||
|
||
tags = { | ||
Name = "Chat Room" | ||
} | ||
} |
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,4 @@ | ||
output "instance_ip_addr" { | ||
# sensitive = true | ||
value = aws_instance.app_server.public_ip | ||
} |
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,13 @@ | ||
terraform { | ||
required_providers { | ||
aws = { | ||
source = "hashicorp/aws" | ||
version = "~> 5" | ||
} | ||
} | ||
required_version = ">= 1.2.0" | ||
} | ||
|
||
provider "aws" { | ||
region = "ap-southeast-1" | ||
} |
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,25 @@ | ||
variable "key_name" { | ||
default = "aws-key" | ||
} | ||
|
||
resource "tls_private_key" "example" { | ||
algorithm = "RSA" | ||
rsa_bits = 4096 | ||
} | ||
|
||
resource "aws_key_pair" "my_ssh_key" { | ||
key_name = var.key_name | ||
public_key = tls_private_key.example.public_key_openssh | ||
} | ||
|
||
resource "local_sensitive_file" "pem_file" { | ||
filename = pathexpand("~/.ssh/${var.key_name}.pem") | ||
file_permission = "600" | ||
directory_permission = "700" | ||
content = tls_private_key.example.private_key_pem | ||
} | ||
|
||
output "private_key" { | ||
value = tls_private_key.example.private_key_pem | ||
sensitive = true | ||
} |
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,36 @@ | ||
variable "aws_api_key" { | ||
type = string | ||
default = "${env("TF_VAR_AWS_API_KEY")}" | ||
sensitive = true | ||
} | ||
|
||
source "amazon-ebs" "basic-example" { | ||
access_key = "${env("AWS_SECRET_ACCESS_KEY")}" | ||
secret_key = "${env("AWS_ACCESS_KEY_ID")}" | ||
region = "ap-southeast-1" | ||
} | ||
|
||
|
||
packer { | ||
required_plugins { | ||
amazon = { | ||
version = ">= 1.2.6" | ||
source = "github.com/hashicorp/amazon" | ||
} | ||
} | ||
} | ||
|
||
source "amazon-ebs" "ubuntu" { | ||
ami_name = "packer-linux-aws" | ||
instance_type = "t2.micro" | ||
region = "ap-southeast-1" | ||
source_ami = "ami-09dac21d1664bc313" | ||
ssh_username = "ubuntu" | ||
} | ||
|
||
build { | ||
sources = ["source.amazon-ebs.ubuntu"] | ||
provisioner "shell" { | ||
script = "ubuntu22.sh" | ||
} | ||
} |
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,66 @@ | ||
#!/bin/bash | ||
|
||
# update | ||
sudo apt-get update && sudo apt-get -y upgrade | ||
|
||
sh -c "$(curl -fsSL https://get.docker.com)" | ||
dockerd | ||
|
||
# certbot | ||
# sudo apt-get install -y certbot | ||
# sudo certbot certonly --standalone --agree-tos --redirect -m pengliheng111@gmail.com -d chat.plhh.xyz --non-interactive | ||
|
||
|
||
sudo apt-get install -y gcc g++ make | ||
|
||
curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash - &&\ | ||
sudo apt-get install -y nodejs | ||
sudo apt-get install -y npm | ||
sudo npm install yarn lerna nodemon -g | ||
|
||
# made port can be visited in public network | ||
# sudo apt-get install ufw | ||
# ufw --force enable | ||
# ufw allow 80/tcp | ||
# ufw allow 443/tcp | ||
# ufw allow 443/udp | ||
# ufw allow 3000:9999/tcp | ||
# ufw disable | ||
|
||
|
||
|
||
# # install zsh | ||
# sudo apt-get install -y zsh | ||
# # sudo rm -rf /root/.oh-my-zsh | ||
# sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended | ||
# sudo chsh -s $(which zsh) | ||
|
||
# # add 2 zsh plugin | ||
# git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions | ||
# git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting | ||
|
||
# # setup zsh config | ||
|
||
# echo 'alias public_ip="dig -4 TXT +short o-o.myaddr.l.google.com @ns1.google.com" | ||
|
||
# export ZSH="$HOME/.oh-my-zsh" | ||
|
||
# ZSH_THEME="bira" | ||
|
||
# plugins=( | ||
# ansible | ||
# docker | ||
# emoji | ||
# git | ||
# git-flow | ||
# terraform | ||
# github | ||
# yarn | ||
# aws | ||
# npm | ||
# nvm | ||
# zsh-autosuggestions | ||
# zsh-syntax-highlighting | ||
# ) | ||
|
||
# source $ZSH/oh-my-zsh.sh' > ~/.zshrc |
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,14 @@ | ||
# route 53 variables | ||
variable "domain_name" { | ||
# default = "plhh.xyz" | ||
# default = "plhh.link" | ||
default = "plh.ninja" | ||
description = "domain name" | ||
type = string | ||
} | ||
|
||
variable "record_name" { | ||
default = "www" | ||
description = "sub domain name" | ||
type = string | ||
} |
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
Oops, something went wrong.