Skip to content

Commit

Permalink
digitalocean pass test (#5721)
Browse files Browse the repository at this point in the history
* force packer build

* disable ami temporarially

* apt and ufw

* initial lotus config

* rename correctly

* apt-get instead of apt

* undo temporary edits

* install before upgrade

* tmp - force digitalocean

* reenable filters

* uncomment ebs

* tmp, remove filter for digitalocean build

* doc

* install ufw (for iams where it isn't installed)

* more amazon regions

* missing comma

* missing comma

* remove unavailable regions

* switch to ubuntu, not minimal

* pro server

* change owner

* change image

* uncomment circleci filters

* remove api from firewall

* tmp: remove circleci filter

* dpkg options

* confold

* try export

* re-add filter
  • Loading branch information
Cory Schwartz authored Mar 25, 2021
1 parent 4d01f8f commit 01202c5
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 4 deletions.
7 changes: 7 additions & 0 deletions tools/packer/etc/motd
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@ You only need to do this once, after which, you can enable and start the miner.



Do you want to access your lotus daemon remotely? Learn how to setup token authentication
and use client libraries from lotus docs.

https://docs.filecoin.io/build/lotus/enable-remote-api-access/



For more information, see https://docs.filecoin.io/
Found a bug? let us know! https://github.com/filecoin-project/lotus
Chat with us on slack! https://filecoinproject.slack.com/archives/CEGN061C5
9 changes: 8 additions & 1 deletion tools/packer/homedir/bashrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
PS1="[\h \w] ⨎ "

export PROMT_DIRTRIM=1

# Where to find the lotus repo
export LOTUS_PATH=/var/lib/lotus
export LOTUS_MINER_PATH=/var/lib/lotus-miner

# The miner is not running in this image by default.
# export LOTUS_MINER_PATH=/var/lib/lotus-miner

# To access the lotus node remotely, the following environment variable may be used.
# export FULLNODE_API_INFO=<token>:/ip4/<public-ip>/tcp/1234/http
22 changes: 21 additions & 1 deletion tools/packer/lotus.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,23 @@ locals {
source "amazon-ebs" "lotus" {
ami_name = "lotus-${var.lotus_network}-${var.git_tag}-${local.timestamp}"
ami_regions = [
"ap-east-1",
"ap-northeast-1",
"ap-northeast-2",
"ap-northeast-3",
"ap-south-1",
"ap-southeast-1",
"ap-southeast-2",
"ca-central-1",
"eu-central-1",
"eu-north-1",
"eu-west-1",
"eu-west-2",
"eu-west-3",
"sa-east-1",
"us-east-1",
"us-east-2",
"us-west-1",
"us-west-2",
]
ami_groups = [
Expand All @@ -37,7 +53,7 @@ source "amazon-ebs" "lotus" {
instance_type = "t2.micro"
source_ami_filter {
filters = {
name = "ubuntu-minimal/images/*ubuntu-focal-20.04-amd64-minimal*"
name = "ubuntu/images/*ubuntu-focal-20.04-amd64-server-*"
root-device-type = "ebs"
virtualization-type = "hvm"
}
Expand Down Expand Up @@ -85,6 +101,10 @@ build {
source = "./tools/packer/systemd/lotus-miner.service"
destination = "lotus-miner.service"
}
provisioner "file" {
source = "./tools/packer/repo/config.toml"
destination = "config.toml"
}
provisioner "file" {
source = "./tools/packer/etc/motd"
destination = "motd"
Expand Down
36 changes: 36 additions & 0 deletions tools/packer/repo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
[API]
ListenAddress = "/ip4/0.0.0.0/tcp/1234/http"
# RemoteListenAddress = ""
# Timeout = "30s"
#
[Libp2p]
ListenAddresses = ["/ip4/0.0.0.0/tcp/5678", "/ip6/::/tcp/5678"]
# AnnounceAddresses = []
# NoAnnounceAddresses = []
# ConnMgrLow = 150
# ConnMgrHigh = 180
# ConnMgrGrace = "20s"
#
[Pubsub]
# Bootstrapper = false
# RemoteTracer = "/dns4/pubsub-tracer.filecoin.io/tcp/4001/p2p/QmTd6UvR47vUidRNZ1ZKXHrAFhqTJAD27rKL9XYghEKgKX"
#
[Client]
# UseIpfs = false
# IpfsOnlineMode = false
# IpfsMAddr = ""
# IpfsUseForRetrieval = false
# SimultaneousTransfers = 20
#
[Metrics]
# Nickname = ""
# HeadNotifs = false
#
[Wallet]
# RemoteBackend = ""
# EnableLedger = false
# DisableLocal = false
#
[Fees]
# DefaultMaxFee = "0.007 FIL"
#
14 changes: 12 additions & 2 deletions tools/packer/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,14 @@ MANAGED_FILES=(
/lib/systemd/system/lotus-daemon.service
/lib/systemd/system/lotus-miner.service
/etc/motd
/var/lib/lotus/config.toml
)

# install libs.
apt update
apt -y install libhwloc15 ocl-icd-libopencl1
export DEBIAN_FRONTEND=noninteractive
apt-get update
apt-get -y install libhwloc15 ocl-icd-libopencl1 ufw
apt-get -y upgrade -q -y -u -o Dpkg::Options::="--force-confold"
ln -s /usr/lib/x86_64-linux-gnu/libhwloc.so.15 /usr/lib/x86_64-linux-gnu/libhwloc.so.5

# Create lotus user
Expand Down Expand Up @@ -55,3 +58,10 @@ done
# Enable services
systemctl daemon-reload
systemctl enable lotus-daemon

# Setup firewall
ufw enable
ufw default deny incoming
ufw default allow outgoing
ufw allow ssh
ufw allow 5678 #libp2p

0 comments on commit 01202c5

Please sign in to comment.