Skip to content

Commit 0bd4acf

Browse files
authored
Update baseline-testing.md
1 parent ad76a62 commit 0bd4acf

1 file changed

Lines changed: 25 additions & 28 deletions

File tree

content/learning-paths/servers-and-cloud-computing/golang-on-azure/baseline-testing.md

Lines changed: 25 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,26 @@ layout: learningpathall
77
---
88

99

10-
### Baseline testing of Golang Web Page on Azure Arm64
11-
This section demonstrates how to test your Go installation on the **Ubuntu Pro 24.04 LTS Arm64** virtual machine by creating and running a simple Go web server that serves a styled HTML page.
10+
### Baseline Testing: Running a Go Web Server on Azure Arm64
11+
To validate your Go toolchain and runtime environment, you can build and run a lightweight web server. This ensures that compilation, networking, and runtime execution are working correctly on your Ubuntu Pro 24.04 LTS Arm64 virtual machine running on Azure Cobalt 100.
1212

13-
**1. Create Project Directory**
14-
15-
First, create a new folder called goweb to contain all project files, and then navigate into it:
13+
1. Create the project directory
14+
15+
Start by creating a new folder to hold your Go web project and navigate to it:
1616

1717
```console
1818
mkdir goweb && cd goweb
1919
```
20-
This command creates a new directory named goweb and then switches into it.
2120

22-
**2. Create HTML Page with Bootstrap Styling**
21+
2. Create an HTML Page with Bootstrap Styling
2322

24-
Next, create a file named `index.html` using the nano editor:
23+
Next, create a simple web page that your Go server will serve. Using the nano editor (or any editor of your choice), create a file named `index.html`:
2524

2625
```console
2726
nano index.html
2827
```
2928

30-
Paste the following HTML code into the index.html file. This builds a simple, styled web page with a header, a welcome message, and a button using Bootstrap.
29+
Paste the following HTML code into the `index.html` file. This page uses Bootstrap for styling and includes a header, a welcome message, and a button that links to a Go-powered API endpoint.
3130

3231
```html
3332
<!DOCTYPE html>
@@ -66,14 +65,14 @@ Paste the following HTML code into the index.html file. This builds a simple, st
6665
</body>
6766
</html>
6867
```
69-
**3. Create Golang Web Server**
68+
3. Create Golang Web Server
7069

71-
Now create the Go program that will serve this web page:
70+
Now, let’s create the Go program that will serve your static HTML page and expose a simple API endpoint.
7271

7372
```console
7473
nano main.go
7574
```
76-
Paste the following code into the main.go file. This sets up a very basic web server that serves files from the current folder, including the **index.html** you just created. When it runs, it will print a message showing the server address.
75+
Paste the following code into the `main.go` file. This sets up a very basic web server that serves files from the current folder, including the `index.html` you just created. When it runs, it will print a message showing the server address.
7776

7877
```go
7978
package main
@@ -105,56 +104,54 @@ func main() {
105104
}
106105
```
107106
{{% notice Note %}}Running on port 80 requires root privileges. Use sudo with the full Go path if needed.{{% /notice %}}
108-
**4. Run on the Web Server**
109107

110-
Run your Go program with:
108+
4. Run the Web Server
109+
110+
Compile and start your Go program with:
111111

112112
```console
113113
sudo /usr/local/go/bin/go run main.go
114114
```
115115

116-
This compiles and immediately starts the server. If the server starts successfully, you will see the following message in your terminal::
116+
This command compiles the Go source code into a binary and immediately starts the server on port 80. If the server starts successfully, you will see the following message in your terminal:
117117

118118
```output
119119
2025/08/19 04:35:06 Server running on http://0.0.0.0:80
120120
```
121-
**5. Allow HTTP Traffic in Firewall**
121+
5. Allow HTTP Traffic in Firewall
122+
123+
On Ubuntu Pro 24.04 LTS virtual machines, UFW (Uncomplicated Firewall) is used to manage firewall rules. By default, it allows only SSH (port 22), while other inbound connections are blocked.
122124

123-
On **Ubuntu Pro 24.04 LTS** virtual machines, **UFW (Uncomplicated Firewall)** is used to manage firewall rules. By default, it allows only SSH (port 22) and blocks most other traffic.
125+
Even if you have already configured Azure Network Security Group (NSG) rules to allow inbound traffic on port 80, the VM level firewall may still block HTTP requests until explicitly opened.
124126

125-
So even if Azure allows HTTP on port 80 (added to inbound ports during VM creation), your VM’s firewall may still block it until you run:
127+
Run the following commands to allow HTTP traffic on port 80:
126128

127129
```console
128130
sudo ufw allow 80/tcp
129131
sudo ufw enable
130132
```
131-
You can verify that HTTP is now allowed with:
133+
After enabling UFW and allowing traffic on port 80, confirm that the firewall is now configured correctly by running:
132134

133135
```console
134136
sudo ufw status
135137
```
136-
You should see an output similar to:
138+
You should see output similar to:
137139
```output
138140
Status: active
139141
140142
To Action From
141143
-- ------ ----
142-
8080/tcp ALLOW Anywhere
143144
80/tcp ALLOW Anywhere
144-
8080/tcp (v6) ALLOW Anywhere (v6)
145145
80/tcp (v6) ALLOW Anywhere (v6)
146146
```
147147

148-
**6. Open in Browser**
149-
150-
Run the following command to print your VM’s public URL, then open it in a browser:
148+
6. Open in a Browser
149+
To quickly get your VM’s public IP address and form the URL, run:
151150

152151
```console
153152
echo "http://$(curl -s ifconfig.me)/"
154153
```
155-
When you visit this link, you should see the styled HTML page being served directly by your Go application.
156-
157-
You should see the Golang web page confirming a successful installation of Golang.
154+
Open this URL in your browser, and you should see the styled HTML landing page being served directly by your Go application.
158155

159156
![golang](images/go-web.png)
160157

0 commit comments

Comments
 (0)