It comes with a Dockerfile and scripts to build your Nginx Reverse Proxy Docker Image and you can run it with Docker Run or Docker Compose.
It enables you to create your server names and their upstream services on your host, your docker containers, your docker compose services or on other servers with just one command.
You want to setup a Chainlink Node quickly with Docker and without paying additional fees for a cloud based Postgres database service, e.g. on on the Google Cloud Platform (GCP)?
Solution:
You can achieve this by running the Chainlink Node itself and also its PostgreSQL database in separate Docker containers.
Watch this YouTube video and see how to setup Chainlink and its PostgreSQL Database with Docker:
With this approach you can save the fees for the database service and you also can save time by utilizing a Container Optimized OS (COS) – Image with Docker already preinstalled.
Follow this 10 steps process to setup the Chainlink Node and its PostgreSQL database with Docker :
Create a VM instance on the Google Cloud Platform (GCP). Choose a machine type with at least 2GB of memory and change the boot disk from Debian to Container Optimized OS. Then create the instance and SSH into it.
Create the directories for the Chainlink Database and the Chainlink Node:
For this demo we use Infura as external provider for the connectivity to the Ethereum blockchain.
If you want to use Infura as well, make sure that you adapt the Infura Project ID accordingly.
Also make sure that you use the same Chainlink Postgres password here that you have used to create the Chainlink Postgres User before.
Create the .password file which holds the password for your node wallet
vi chainlink/chainlink_rinkeby/.password
Enter your password for your node wallet. This password
– must be longer than 12 characters
– must contain at least 3 uppercase characters
– must contain at least 3 numbers
– must contain at least 3 symbols
Create the .api file which holds the credentials for the GUI interface of the node
vi chainlink/chainlink_rinkeby/.api
and enter your email address and password. This password must be 8 to 50 characters.
<YOUR_EMAIL_ADDRESS>
<YOUR_NODE_GUI_PASSWORD>
Now we can create the container for the chainlink node itself
docker run --name chainlink_rinkeby --network host -p 6688:6688 -v $HOME/chainlink/chainlink_rinkeby:/chainlink -it --env-file=$HOME/chainlink/chainlink_rinkeby/.env smartcontract/chainlink:0.10.8 local n -p /chainlink/.password -a /chainlink/.api
Note that we have added “–network host” to the command since we run the database locally from the node’s perspective.
Access the GUI of your new Chainlink node:
Open a command prompt on our local machine and authenticate with gcloud, in order to be able to access the GUI of your new Chainlink Node
gcloud auth login
Note: Alternatively you can download and authenticate with your API keys
Linux users which are dynamically created in Kubernetes Containers are not persistant. Therefore, whenever a Kubernetes Pod gets restarted, the dynamically created users are lost.
For example, if you want to run multiple vhosts in a Kubernetes Container under separate UIDs and GIDs with apache2-mpm-itk (which is an MPM – Multi-Processing Module for the Apache web server), a solution for persisting Linux users like the following is required:
Solution:
This solution desribes how to survive Kubernetes Pod restarts by dynamically recreating Linux users in a Kubernetes container whenever a new pod is created.
Create a Kubernetes ConfigMap (or Secret) for storing custom users:
Create a script which reads the custom users from the ConfigMap mounted in /etc/linux-users and which recreates the users when the pod is restarted. Store the script in another Kubernetes ConfigMap as follows: