Beego is an MVC framework written in Go.
App name bhi
stands for Beego Hello
.
The code is generated by bee new bhi
command.
The index page prints "Hello $NAME", with $NAME coming from environment variable NAME
.
The app also collects user feedback data and generates a PNG chart out of it.
bee run
Upload the binary:
bee pack && rsync -avH ./bhi.tar.gz remote.host.name:
Setup host:
cat <<'EOF' | sudo tee /etc/systemd/system/beego.service
# see https://beego.me/docs/deploy/systemctl.md
[Unit]
Description=beego
AssertPathExists=/home/some-user/bhi/bhi
[Service]
Environment="NAME=Username"
WorkingDirectory=/home/some-user/bhi
ExecStart=/home/some-user/bhi/bhi
ExecReload=/bin/kill -HUP $MAINPID
LimitNOFILE=65536
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl daemon-reload
sudo systemctl enable beego
tar xvf $HOME/bhi.tar.gz -C $HOME/bhi/ --exclude=conf/app.conf
cat <<EOF > $HOME/bhi/conf/app.conf
appname = bhi
httpport = 8080
runmode = prod
EOF
sudo systemctl start beego
The app collects traces in AWS X-Ray format and sends them to the tracing daemon at UDP/localhost:2000.
Make sure the xray
daemon is running
and the AWSXRayDaemonWriteAccess
IAM role
is assigned to your compute.
To see the traces, switch to the x-ray web console. Then, choose the right region in the top right corner.