I’ve been working with HydraDX recently and attempting to run it in Docker. Unfortunately, the last runnable version of HydraDX is significantly outdated, and it no longer connects to active peers. Furthermore, when attempting to use a more recent HydraDX Docker image, an error arises indicating “version `GLIBC_2.34′ not found.” As of the most recent version available on September 4th, 2023, identified as pr-664, this issue still persists without resolution. Following a period of challenges and without delving into the underlying causes of the issue, I decided to immerse myself in the Rust program and scrutinize the code. Through this process, I identified some outdated configurations and instances of Docker misuse.
It seems that encountering similar issue when compiling the rust program and running it in Docker environment is quite common, especially within the blockchain industry.
However, please note that the focus of this post is only on building a Docker image for a Rust program (or at least a program linked with glibc). Understanding HydraDX or blockchain concepts is not necessary to grasp the content of this discussion. But with a minimal knowledge of Docker is required.
By visualising team cooperation through these 3 concentric circles (owned, learnt, known), team members can develop a strong sense of personal responsibility, foster collaboration and learning within the team, and gain a broader understanding of the larger context in which they operate. This approach promotes a holistic and effective teamwork dynamic.
Owned Circle: Take full responsibility for individual work.
Learnt Circle: Understand and learn about others’ work that may impact own tasks.
Known Circle: Ensure the team’s goals and the work of all team members are known to everybody.
And there are four points as essential aspects of effective team cooperation when we are considering 3cc.
Individual Responsibility: Each team member takes full ownership and responsibility for their own work. No one should take responsibility away from others in routine tasks.
Cross-Functional Learning: Team members actively learn about the work of their colleagues, fostering a comprehensive understanding of how others’ outcomes may affect their own tasks.
Shared Understanding of Goals: The team’s goals and objectives must be known and agreed upon by all team members. It is important to ensure that everyone is aligned with the common purpose and direction.
Work Awareness: Team members should have awareness and knowledge of each other’s roles, responsibilities, and ongoing work. This understanding promotes collaboration, coordination, and support among team members.
In urgent incidents, when everyone is under pressure, it is crucial to trust individuals in their owned circle to take responsibility and provide solutions. Therefore, offering support rather than asking questions or giving orders can significantly ease the situation. Shifting the communication approach from asking others, ‘Have you done…/You should do…’ to considering ‘What can I do?’ or asking, ‘Can I offer any help on…?’ accelerates the problem-solving process and fosters a better team dynamic. This not only speeds up the resolution progress but also improves the overall well-being of everyone involved.
To follow yesterday progress, I will use the board to fetch the index page of example.org in two scenarios,
Get an URL served on HTTP
Get an URL served on HTTPS
There are multiple ways to finish the job, for example, there are different libraries can be used, or, even in the same library, there are still multiple options to implement the same function. So, please notice here, what I mentioned below just a functional way. It’s not the only solution nor the best solution.
Get an URL served on HTTP
The ESP8266 library has really good examples related to HTTPClient, HTTPSClient etc. I copied the source code from the example and made a little change to get an easy output.
#include <WiFiClient.h>
WiFiClient client;
void getURL(String url) {
HTTPClient http;
if (http.begin(client, url)) {
Serial.print("[HTTP] GET ... ");
// start connection and send HTTP header
int httpCode = http.GET();
// httpCode will be negative on error
if (httpCode > 0) {
// HTTP header has been send and Server response header has been handled
Serial.printf("code: %d\n", httpCode);
// file found at server
if (httpCode == HTTP_CODE_OK || httpCode == HTTP_CODE_MOVED_PERMANENTLY) {
String payload = http.getString();
Serial.printf("Payload: %d byte\n", payload.length());
blink(2);
}
} else {
Serial.printf("failed, error: %d %s\n", httpCode, http.errorToString(httpCode).c_str());
blink(5);
}
http.end();
} else {
Serial.printf("[HTTP} Unable to connect\n");
blink(5);
}
}
For a successful case, it will return the length of the payload.
Or if anything unusual happened, it returns the error code and message. Such as,
Establish an HTTPS request
To establish an HTTPS request, replace <WiFiClient.h> to <WiFiClientSecure.h> and find a way to validate with the server. In the example “BearSSL_Validation.ino“, most possible ways have been discussed and compared. It’s worth to read. In fetchCertAuthority() , it shows what will happen with and without NTP synced. I will put the screenshot of the result of the example here.
Therefore, the major change would be replacing <WiFiClient.h> to <WiFiClientSecure.h> and using WiFiClientSecure instance instead of WiFiClient. An extra setup is needed.
Most of the times, I want my ESP8266 board to communicate with the server through a securer channel such as MQTT over TLS or HTTPS. However, to verify the certification, system’s date/time has to be in a proper configuration.
Since ESP8266 is designed to have the network, I believe NTP is definitely the first choice and is the easiest one to use. In this post, I will show you how to get date/time and set it by using NTP.
Dummy project
A dummy project is set up for this post. And of course, it can be a part of a real project since the WWW is very important to my most of side projects. The board will do,
Connect to the WiFi network;
Use the GET method communicate with www.example.com every 5 seconds;
Flash build-in LED twice if 200 was returned by the server;
Or flash build-in LED 5 times if an error occurred.
Flash LED is the easiest part. But remember to put pinMode(LED_BUILTIN, OUTPUT); in the very beginning to initialise the output pin.
void blink(int t) {
for(int i = 0; i < t; i ++) {
digitalWrite(LED_BUILTIN, LOW);
delay(500);
digitalWrite(LED_BUILTIN, HIGH);
delay(200);
}
}