Browse Source

latest

pull/1/head
Jeffrey Paul 2 years ago
parent
commit
55f7084482
No known key found for this signature in database
6 changed files with 89 additions and 1 deletions
  1. +3
    -0
      .gitignore
  2. +12
    -0
      bionic-defaults/fetch-ipget-goget.sh
  3. +0
    -1
      homedir.makefile/Makefile
  4. +21
    -0
      misc/do-mirror-deploy.sh
  5. +44
    -0
      tf/ipfs-mirror.tf
  6. +9
    -0
      tf/setup.sh

+ 3
- 0
.gitignore View File

@@ -1,2 +1,5 @@
.DS_Store
*.pyc
.terraform/
terraform.tfstate
terraform.tfstate.backup

+ 12
- 0
bionic-defaults/fetch-ipget-goget.sh View File

@@ -0,0 +1,12 @@
#!/bin/bash

# sneak@nostromo-2:~$ ipfs name resolve /ipns/dist.ipfs.io/ipget/v0.3.0/ipget_v0.3.0_linux-amd64.tar.gz
# /ipfs/QmUDECZXueqXdcBEu3SLf8J19QfubhksdrDZeh1exCVMDz/ipget/v0.3.0/ipget_v0.3.0_linux-amd64.tar.gz
# sneak@nostromo-2:~$ ipfs resolve /ipfs/QmUDECZXueqXdcBEu3SLf8J19QfubhksdrDZeh1exCVMDz/ipget/v0.3.0/ipget_v0.3.0_linux-amd64.tar.gz
# /ipfs/QmQcKL42JqZtWKjbcCys27iaAKybRcchSFWaD9sF8LEUKL

apt update
apt -y install golang
go get -d github.com/ipfs/ipget
cd $HOME/go/src/github.com/ipfs/ipget
make install

+ 0
- 1
homedir.makefile/Makefile View File

@@ -44,7 +44,6 @@ cleanup:
clean: cleanup
@echo $(PREFIX) $@ $(SUFFIX)
@-rm -rf ~/.tmp/*
@-rm -rf ~/Library/Caches/*
@-rm -rf ~/.Trash/*
@-rm -rf $(JUNKFILES)


+ 21
- 0
misc/do-mirror-deploy.sh View File

@@ -0,0 +1,21 @@
#!/bin/bash

apt update
apt upgrade -y
apt install -y docker.io byobu
byobu-enable

mkdir -p /var/lib/ubuntumirror /var/lib/ipfs

docker rmi -f sneak/ipfs-ubuntu-mirror:latest
docker run -d \
-p 4001:4001 \
-p 4002:4002/udp \
-p 5001:5001 \
-p 8080:8080 \
-p 8081:8081 \
-v /var/lib/ubuntumirror:/var/lib/ubuntumirror \
-v /var/lib/ipfs:/var/lib/ipfs \
--env UBUNTU_MIRROR_SOURCE=nyc1.mirrors.digitalocean.com \
sneak/ipfs-ubuntu-mirror:latest


+ 44
- 0
tf/ipfs-mirror.tf View File

@@ -0,0 +1,44 @@
variable "do_token" {}
variable "pub_key" {}
variable "pvt_key" {}
variable "ssh_fingerprint" {}

provider "digitalocean" {
token = "${var.do_token}"
}

resource "digitalocean_droplet" "ipfs-ubuntu-mirror" {
image = "ubuntu-18-04-x64"
name = "ipfs-ubuntu-mirror"
region = "nyc1"
size = "s-6vcpu-16gb"
ipv6 = true
monitoring = true
ssh_keys = [
"${var.ssh_fingerprint}"
]

connection {
user = "root"
type = "ssh"
private_key = "${file(var.pvt_key)}"
timeout = "2m"
}

provisioner "remote-exec" {
inline = [
"while PID=$(pidof -s apt-get); do tail --pid=$PID -f /dev/null; done",
"cat /etc/apt/sources.list",
"add-apt-repository universe",
"add-apt-repository multiverse",
"export PATH=$PATH:/usr/bin:/usr/local/bin",
"export GOPATH=$HOME/go",
"export DEBIAN_FRONTEND=noninteractive",
"apt update && apt install -y golang docker.io",
"go get -d github.com/ipfs/ipget",
"cd $HOME/go/src/github.com/ipfs/ipget",
"make install",
"docker run -p 4001:4001 -p 4002:4002/udp -p 5001:5001 -p 8080:8080 -p 8081:8081 -v /var/lib/ubuntumirror:/var/lib/ubuntumirror -v /var/lib/ipfs:/var/lib/ipfs -d sneak/ipfs-ubuntu-mirror"
]
}
}

+ 9
- 0
tf/setup.sh View File

@@ -0,0 +1,9 @@
export DIGITALOCEAN_TOKEN="$(cat ~/Documents/sync/secrets/apis/digitalocean/terraform.apikey.txt)"

terraform apply \
-var "do_token=${DIGITALOCEAN_TOKEN}" \
-var "pub_key=$HOME/Documents/sync/secrets/ssh/terraform-bootstrap.pub" \
-var "pvt_key=$HOME/Documents/sync/secrets/ssh/terraform-bootstrap" \
-var "ssh_fingerprint=a2:74:1f:87:0b:09:91:ed:f4:a6:b2:8f:c7:9d:f5:95"



Loading…
Cancel
Save