Created
September 27, 2021 02:14
-
-
Save c9s/ec56bc58dd7015ae8a5dfdbe09a266b2 to your computer and use it in GitHub Desktop.
chainlink bootstraper
This file contains hidden or 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
#!/bin/bash | |
curl -fsSL https://get.docker.com -o get-docker.sh | |
sh get-docker.sh | |
apt-get install -y postgresql | |
echo "host all all 172.17.0.0/16 md5" >> /etc/postgresql/12/main/pg_hba.conf | |
echo "listen_addresses = 'localhost,172.17.0.1'" >> /etc/postgresql/12/main/postgresql.conf | |
systemctl restart postgresql | |
sudo -u postgres createuser --superuser chainlink | |
sudo -u postgres createdb --owner=chainlink chainlink | |
mkdir ~/.chainlink | |
read -p "Your API Email: " API_EMAIL | |
echo $API_EMAIL > ~/.chainlink/.api | |
API_PASSWORD=$(< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c${1:-32};echo;) | |
echo $API_PASSWORD >> ~/.chainlink/.api | |
PASSWORD=$(< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c${1:-32};echo;) | |
echo $PASSWORD > ~/.chainlink/.user-password | |
useradd chainlink | |
yes $PASSWORD | passwd chainlink | |
# sudo -u chainlink psql chainlink | |
cat <<END > ~/.chainlink/.env | |
ROOT=/chainlink | |
LOG_LEVEL=debug | |
ETH_CHAIN_ID=1 | |
CHAINLINK_TLS_PORT=0 | |
SECURE_COOKIES=false | |
GAS_UPDATER_ENABLED=true | |
ALLOW_ORIGINS=* | |
ETH_URL=wss://mainnet.infura.io/ws/v3/__YOUR_PROJECT_ID__ | |
# For host networking use: | |
# DATABASE_URL=postgresql://chainlink:[email protected]:5432/chainlink | |
DATABASE_URL=postgresql://chainlink:[email protected]:5432/chainlink | |
DATABASE_TIMEOUT=0 | |
END | |
# for first run setup | |
cd ~/.chainlink && \ | |
docker run -it \ | |
--name chainlink \ | |
--restart=always \ | |
--detach \ | |
-p 16688:6688 \ | |
-v ~/.chainlink:/chainlink \ | |
--env-file=.env \ | |
smartcontract/chainlink:0.10.14 local n | |
# after setup run this: | |
# cd ~/.chainlink && \ | |
# docker run -it \ | |
# --name chainlink \ | |
# --restart=always \ | |
# --detach \ | |
# -p 16688:6688 \ | |
# -v ~/.chainlink:/chainlink \ | |
# --env-file=.env \ | |
# smartcontract/chainlink:0.10.14 local n -a /chainlink/.api -p /chainlink/.password |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment