p.me-docker (go-pttai)

by hsiaochuanheng
9 deployments · 1 still active · last rev. 6 months ago

Deploy p.me docker container to quickly run a p.me on linode.

Compatible with: Ubuntu 16.04 LTS, Ubuntu 18.04 LTS
						#!/bin/bash
#<UDF name="PUBKEY" label="ssh-pubkey">
#<UDF name="HTTPPORT" label="http-port" default="9774">
#<UDF name="APIPORT" label="api-port" default="14779">

# admin
groupadd admin
useradd -b /home -g admin -m -s /bin/bash admin

mkdir -p /home/admin/.ssh
echo "${PUBKEY}" > /home/admin/.ssh/authorized_keys
chown -R admin ~admin/.ssh

echo "admin    ALL = NOPASSWD: ALL" >> /etc/sudoers

echo "HTTPPORT: ${HTTPPORT} APIPORT: ${APIPORT}" > /home/admin/log

# docker-ce
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
apt-get update
apt-cache policy docker-ce
apt-get install -y docker-ce

# go-pttai container

docker pull ailabstw/go-pttai:latest

docker run -e HTTPPORT=${HTTPPORT} -e APIPORT=${APIPORT} -itd --restart=always -p 9487:9487 -p 127.0.0.1:9774:9774 -p 127.0.0.1:14779:14779 -v /home/admin/pttai.docker:/root/.pttai --name go-pttai ailabstw/go-pttai:latest gptt "--testp2p" "--httpdir" "/static" "--httpaddr" "0.0.0.0:9774" "--rpcaddr" "0.0.0.0" "--exthttpaddr" "http://localhost:${HTTPPORT}" "--extrpcaddr" "http://localhost:${APIPORT}"

# update
apt-get update
apt-get dist-upgrade -y

wait $!

reboot