https://github.com/cloudacademy/tcp-echo-app
TCP Echo App
https://github.com/cloudacademy/tcp-echo-app
cloudacademy container devops docker echo go kubernetes tcp
Last synced: 3 months ago
JSON representation
TCP Echo App
- Host: GitHub
- URL: https://github.com/cloudacademy/tcp-echo-app
- Owner: cloudacademy
- Created: 2022-09-15T05:10:29.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-09-15T23:42:53.000Z (over 2 years ago)
- Last Synced: 2025-01-13T06:07:19.339Z (5 months ago)
- Topics: cloudacademy, container, devops, docker, echo, go, kubernetes, tcp
- Language: Go
- Homepage:
- Size: 5.86 KB
- Stars: 0
- Watchers: 4
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README

# TCP Echo App
A simple TCP echoing application.The TCP echoing application been developed using the Go programming language. It is designed to simply echo back any data that it recieves, together with the client's source IP address. Clients connect to this application and communicate using TCP (layer-4) connections.
## Usage
To start the TCP echo application, configure the `HOSTPORT` environment variable. `HOSTPORT` represents the listening address and port that the TCP echo application listens on.Startup:
```
HOSTPORT=0.0.0.0:9091 tcpapp
```## Docker
The TCP echoing application has been packaged into a Docker image. The Docker image can be pulled with the following command:```
docker pull cloudacademydevops/tcpapp:v1
```Use the following command to launch the TCP echoing application within Docker:
```
docker run --name tcpapp -p 9091:9091 --detach cloudacademydevops/tcpapp:v1
```## Kubernetes
Use the following command to launch the TCP echoing application as a Deployment resource within a cluster:```
cat << EOF | kubectl apply -f -
apiVersion: apps/v1
kind: Deployment
metadata:
name: tcpapp
namespace: tcpapp
spec:
selector:
matchLabels:
app.kubernetes.io/name: tcpapp
replicas: 2
template:
metadata:
labels:
app.kubernetes.io/name: tcpapp
spec:
containers:
- image: cloudacademydevops/tcpapp:v1
imagePullPolicy: Always
name: tcpapp
ports:
- containerPort: 9091
EOF
```## Build
The following commands can be used to build and package the source code:Current operating system:
```
go build .
```Linux operating system:
```
CGO_ENABLED=0 GOOS=linux go build -o tcpapp .
```Docker:
```
docker buildx build --platform=linux/amd64 -t cloudacademydevops/tcpapp:v1 .
```