feat: publish script and cleanup
This commit is contained in:
@@ -1,3 +1,8 @@
|
|||||||
.gitignore
|
.gitignore
|
||||||
.dockerignore
|
.dockerignore
|
||||||
Dockerfile
|
Dockerfile
|
||||||
|
|
||||||
|
**/plugged
|
||||||
|
**/completions
|
||||||
|
**/conf.d
|
||||||
|
**/fish_variables
|
||||||
|
|||||||
4
.gitignore
vendored
4
.gitignore
vendored
@@ -8,11 +8,7 @@
|
|||||||
**/known_hosts*
|
**/known_hosts*
|
||||||
|
|
||||||
# setup files
|
# setup files
|
||||||
**/plugged
|
|
||||||
**/autoload
|
**/autoload
|
||||||
**/completions
|
|
||||||
**/conf.d
|
|
||||||
**/fish_variables
|
|
||||||
**/gcloud
|
**/gcloud
|
||||||
**/coc
|
**/coc
|
||||||
**/configstore
|
**/configstore
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
# andrejusk/dotfiles
|
# dots.andrejus.dev
|
||||||
|
|
||||||
Collection of experimental dotfiles and supporting install scripts.
|
Collection of experimental dotfiles and supporting install scripts.
|
||||||
|
|
||||||
## Install
|
## Install
|
||||||
|
|
||||||
wget https://raw.githubusercontent.com/andrejusk/dotfiles/master/scripts/setup.sh -qO - | bash
|
wget https://dots.andrejus.dev/setup.sh -qO - | bash
|
||||||
|
|
||||||
## Stack
|
## Stack
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# env:
|
env:
|
||||||
# TERM: xterm-256color
|
TERM: xterm-256color
|
||||||
|
|
||||||
window:
|
window:
|
||||||
dynamic_title: true
|
dynamic_title: true
|
||||||
|
|||||||
5
files/home/.config/fish/.gitignore
vendored
5
files/home/.config/fish/.gitignore
vendored
@@ -1,2 +1,3 @@
|
|||||||
functions
|
completions
|
||||||
!functions/nvm.fish
|
conf.d
|
||||||
|
fish_variables
|
||||||
|
|||||||
@@ -4,3 +4,4 @@ jorgebucaran/replay.fish
|
|||||||
joseluisq/gitnow
|
joseluisq/gitnow
|
||||||
tomyun/base16-fish
|
tomyun/base16-fish
|
||||||
PatrickF1/fzf.fish
|
PatrickF1/fzf.fish
|
||||||
|
jorgebucaran/fisher
|
||||||
|
|||||||
1
files/home/.config/nvim/.gitignore
vendored
Normal file
1
files/home/.config/nvim/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
plugged
|
||||||
@@ -48,13 +48,6 @@ export YARN_DIR=${YARN_DIR:-"$HOME/.yarn"}
|
|||||||
mkdir -p "$YARN_DIR"
|
mkdir -p "$YARN_DIR"
|
||||||
export PATH="$YARN_DIR/bin:$PATH"
|
export PATH="$YARN_DIR/bin:$PATH"
|
||||||
|
|
||||||
# fzf
|
|
||||||
export FZF_DEFAULT_OPTS="--reverse"
|
|
||||||
export FZF_DEFAULT_COMMAND='fdfind --type f --hidden --follow --exclude .git'
|
|
||||||
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
|
|
||||||
export FZF_COMPLETION_TRIGGER='**'
|
|
||||||
[ -f ~/.fzf.bash ] && source ~/.fzf.bash
|
|
||||||
|
|
||||||
# z (jump around)
|
# z (jump around)
|
||||||
export Z_DATA_DIR=${Z_DATA:-"$XDG_DATA_HOME/z"}
|
export Z_DATA_DIR=${Z_DATA:-"$XDG_DATA_HOME/z"}
|
||||||
export Z_DATA=${Z_DATA:-"$Z_DATA_DIR/data"}
|
export Z_DATA=${Z_DATA:-"$Z_DATA_DIR/data"}
|
||||||
@@ -74,3 +67,4 @@ fi
|
|||||||
# (__) (__)(_")("_)\_)-' '-(_/(__) (__)(__)
|
# (__) (__)(_")("_)\_)-' '-(_/(__) (__)(__)
|
||||||
#
|
#
|
||||||
alias j="z"
|
alias j="z"
|
||||||
|
alias fd=`which fdfind`
|
||||||
|
|||||||
@@ -1,2 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
poetry --version
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
java --version
|
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
if [ ! -d ~/.emacs.d ]; then
|
if [ ! -d ~/.emacs.d ]; then
|
||||||
|
echo "Cloning spacemacs"
|
||||||
git clone https://github.com/syl20bnr/spacemacs ~/.emacs.d
|
git clone https://github.com/syl20bnr/spacemacs ~/.emacs.d
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -3,9 +3,11 @@ docker --version
|
|||||||
|
|
||||||
readonly docker_group="docker"
|
readonly docker_group="docker"
|
||||||
if ! grep -q "$docker_group" /etc/group; then
|
if ! grep -q "$docker_group" /etc/group; then
|
||||||
|
echo "Adding docker group"
|
||||||
sudo groupadd "$docker_group"
|
sudo groupadd "$docker_group"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! groups "$USER" | grep -q "\b$docker_group\b"; then
|
if ! groups "$USER" | grep -q "\b$docker_group\b"; then
|
||||||
|
echo "Adding user to docker group"
|
||||||
sudo usermod -aG docker "$USER"
|
sudo usermod -aG docker "$USER"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -1,2 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
gcloud --version
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
firebase --version
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
aws --version
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
terraform --version
|
|
||||||
@@ -51,6 +51,7 @@
|
|||||||
"fish",
|
"fish",
|
||||||
"fonts-nanum",
|
"fonts-nanum",
|
||||||
"fortune-mod",
|
"fortune-mod",
|
||||||
|
"fzf",
|
||||||
"google-cloud-sdk",
|
"google-cloud-sdk",
|
||||||
"git",
|
"git",
|
||||||
"kubectl",
|
"kubectl",
|
||||||
|
|||||||
11
scripts/publish.sh
Normal file → Executable file
11
scripts/publish.sh
Normal file → Executable file
@@ -1,8 +1,11 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -eo pipefail
|
set -eo pipefail
|
||||||
|
|
||||||
#
|
BUCKET=${BUCKET:-"dots.andrejus.dev"}
|
||||||
# Script that publishes the set up script for new installations.
|
|
||||||
#
|
|
||||||
|
|
||||||
echo "Publishing..."
|
NAME=$(basename "$0")
|
||||||
|
REL_DIR=$(dirname "$0")
|
||||||
|
ABS_DIR=$(readlink -f $REL_DIR/../) # Scripts are nested inside of /scripts
|
||||||
|
|
||||||
|
# Publish setup script to public bucket
|
||||||
|
gsutil cp "$ABS_DIR/scripts/setup.sh" "gs://$BUCKET/setup.sh"
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ setup_dir=${DOTFILES_DIR:-$HOME/.dotfiles}
|
|||||||
|
|
||||||
# Prevent overwriting existing installation
|
# Prevent overwriting existing installation
|
||||||
mkdir -p $setup_dir
|
mkdir -p $setup_dir
|
||||||
if [ -z `ls -A $setup_dir` ]; then
|
if [[ -z $(ls -A $setup_dir) ]]; then
|
||||||
echo "Setting up $setup_dir"
|
echo "Setting up $setup_dir"
|
||||||
else
|
else
|
||||||
echo "Failed: Setup directory not empty $setup_dir"
|
echo "Failed: Setup directory not empty $setup_dir"
|
||||||
|
|||||||
@@ -1,36 +1,112 @@
|
|||||||
# Static bucket
|
locals {
|
||||||
|
fqdn = "${var.domain}."
|
||||||
|
}
|
||||||
|
|
||||||
|
# =================================================================
|
||||||
|
# Public bucket for static content
|
||||||
|
# =================================================================
|
||||||
|
resource "google_project_service" "storage" {
|
||||||
|
service = "storage.googleapis.com"
|
||||||
|
}
|
||||||
|
|
||||||
resource "google_storage_bucket" "bucket" {
|
resource "google_storage_bucket" "bucket" {
|
||||||
provider = google-beta
|
name = var.domain
|
||||||
|
depends_on = [google_project_service.storage]
|
||||||
|
|
||||||
project = var.project
|
location = var.gcs_location
|
||||||
|
}
|
||||||
|
|
||||||
name = var.domain
|
resource "google_storage_default_object_access_control" "bucket_public" {
|
||||||
location = "EU"
|
bucket = google_storage_bucket.bucket.name
|
||||||
storage_class = "MULTI_REGIONAL"
|
role = "READER"
|
||||||
|
entity = "allUsers"
|
||||||
|
}
|
||||||
|
|
||||||
versioning {
|
|
||||||
enabled = var.enable_versioning
|
# =================================================================
|
||||||
|
# Expose bucket via HTTPS using Cloud CDN
|
||||||
|
#
|
||||||
|
# Adapted from
|
||||||
|
# https://medium.com/cognite/configuring-google-cloud-cdn-with-terraform-ab65bb0456a9
|
||||||
|
# =================================================================
|
||||||
|
resource "google_project_service" "compute" {
|
||||||
|
service = "compute.googleapis.com"
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "google_compute_backend_bucket" "backend" {
|
||||||
|
name = "${var.prefix}-backend"
|
||||||
|
depends_on = [google_project_service.compute]
|
||||||
|
|
||||||
|
bucket_name = google_storage_bucket.bucket.name
|
||||||
|
description = "Bucket backend for serving static content through CDN"
|
||||||
|
enable_cdn = true
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "google_compute_url_map" "urlmap" {
|
||||||
|
name = "${var.prefix}-urlmap"
|
||||||
|
description = "URL map to bucket backend service"
|
||||||
|
default_service = google_compute_backend_bucket.backend.self_link
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "google_compute_managed_ssl_certificate" "certificate" {
|
||||||
|
name = "${var.prefix}-certificate"
|
||||||
|
depends_on = [google_project_service.compute]
|
||||||
|
|
||||||
|
managed {
|
||||||
|
domains = [local.fqdn]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Allow public read
|
resource "google_compute_target_https_proxy" "https" {
|
||||||
resource "google_storage_default_object_acl" "bucket_acl" {
|
name = "${var.prefix}-https-proxy"
|
||||||
provider = google-beta
|
url_map = google_compute_url_map.urlmap.self_link
|
||||||
bucket = google_storage_bucket.bucket.name
|
ssl_certificates = [google_compute_managed_ssl_certificate.certificate.self_link]
|
||||||
role_entity = ["READER:allUsers"]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# DNS entry
|
resource "google_compute_global_address" "ipv4" {
|
||||||
resource "google_dns_record_set" "cname" {
|
name = "${var.prefix}-ipv4"
|
||||||
provider = google-beta
|
depends_on = [google_project_service.compute]
|
||||||
|
|
||||||
depends_on = [google_storage_bucket.bucket]
|
ip_version = "IPV4"
|
||||||
|
address_type = "EXTERNAL"
|
||||||
|
}
|
||||||
|
|
||||||
project = var.project
|
resource "google_compute_global_address" "ipv6" {
|
||||||
|
name = "${var.prefix}-ipv6"
|
||||||
|
depends_on = [google_project_service.compute]
|
||||||
|
|
||||||
name = "${var.domain}."
|
ip_version = "IPV6"
|
||||||
|
address_type = "EXTERNAL"
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "google_compute_global_forwarding_rule" "fwd_ipv4" {
|
||||||
|
name = "${var.prefix}-fwd-ipv4"
|
||||||
|
target = google_compute_target_https_proxy.https.self_link
|
||||||
|
ip_address = google_compute_global_address.ipv4.address
|
||||||
|
port_range = "443"
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "google_compute_global_forwarding_rule" "fwd_ipv6" {
|
||||||
|
name = "${var.prefix}-fwd-ipv6"
|
||||||
|
target = google_compute_target_https_proxy.https.self_link
|
||||||
|
ip_address = google_compute_global_address.ipv6.address
|
||||||
|
port_range = "443"
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "google_dns_record_set" "dns_a_record" {
|
||||||
|
name = local.fqdn
|
||||||
managed_zone = var.dns_zone
|
managed_zone = var.dns_zone
|
||||||
type = "CNAME"
|
|
||||||
ttl = 300
|
type = "A"
|
||||||
rrdatas = ["c.storage.googleapis.com."]
|
ttl = var.dns_ttl
|
||||||
|
rrdatas = [google_compute_global_address.ipv4.address]
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "google_dns_record_set" "dns_aaaa_record" {
|
||||||
|
name = local.fqdn
|
||||||
|
managed_zone = var.dns_zone
|
||||||
|
|
||||||
|
type = "AAAA"
|
||||||
|
ttl = var.dns_ttl
|
||||||
|
rrdatas = [google_compute_global_address.ipv6.address]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
output "bucket_url" {
|
output "bucket_url" {
|
||||||
value = "storage.googleapis.com/${var.domain}"
|
value = "storage.googleapis.com/${var.domain}"
|
||||||
}
|
}
|
||||||
|
|
||||||
output "bucket_link" {
|
output "bucket_link" {
|
||||||
value = google_storage_bucket.bucket.self_link
|
value = google_storage_bucket.bucket.self_link
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,8 @@
|
|||||||
|
variable "prefix" {
|
||||||
|
description = "Resource prefix"
|
||||||
|
default = "dots"
|
||||||
|
}
|
||||||
|
|
||||||
variable "project" {
|
variable "project" {
|
||||||
description = "Google Cloud project to host resources in"
|
description = "Google Cloud project to host resources in"
|
||||||
type = string
|
type = string
|
||||||
@@ -12,3 +17,15 @@ variable "dns_zone" {
|
|||||||
description = "Cloud DNS zone to use"
|
description = "Cloud DNS zone to use"
|
||||||
type = string
|
type = string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
variable "gcs_location" {
|
||||||
|
type = string
|
||||||
|
description = "Google Stoage location to provision resources in"
|
||||||
|
default = "EU" # Multi-region, Europe
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "dns_ttl" {
|
||||||
|
type = number
|
||||||
|
description = "DNS TTL to use for records"
|
||||||
|
default = 3600
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user