GoToolkits Description Document
Preparation.
Environment for Ubuntu 20.04(LTS) with Golang1.17.3.
# Modify to Tsinghua list first.
apt update
apt install vim curl wget git -y
apt install net-tools procps -y
# Add Nginx list.
echo "deb http://nginx.org/packages/mainline/ubuntu focal nginx" > /etc/apt/sources.list.d/nginx.list
curl -o /tmp/nginx_signing.key https://nginx.org/keys/nginx_signing.key
mv /tmp/nginx_signing.key /etc/apt/trusted.gpg.d/nginx_signing.asc
# Check Nginx and Redis version.
apt-cache madison nginx redis
# Install Nginx and Redis.
apt install nginx redis -y
# Install Golang1.17.2
wget https://studygolang.com/dl/golang/go1.17.3.linux-amd64.tar.gz
rm -rf /usr/local/go && tar -C /usr/local -xzf go1.17.3.linux-amd64.tar.gz
export PATH=$PATH:/usr/local/go/bin
go version
# Start Redis with default config.
redis-server /etc/redis/redis.conf
# export PATH=$PATH:/usr/local/go/bin => ~/.profile
source ~/.profile
# Set Proxy for go install (or go get).
go env -w GO111MODULE=on
go env -w GOPROXY=https://goproxy.cn,direct
# go env -w GOPROXY=https://goproxy.io,direct
# go env -w GOPROXY=https://mirrors.aliyun.com/goproxy
# Install Go-Redis for go environment.
go install github.com/go-redis/redis/v8@latest
# Install Go Iris for go environment.
go install github.com/kataras/iris/v12@latest
Include to project.
Create program like entry
with go.mod file.
Repo.
Docker
docker run -itd -p 4200:4200 -p 9000-9010:9000-9010 -v /Users/mac/Documents/Projects:/projects --name fw debian:latest
docker run -itd --name jupyter -p 8888:8888 tensorflow/tensorflow:latest-jupyter
docker run -itd --name p36tf115 -p 8888:8888 python:3.6
docker exec -d p36tf115 jupyter notebook --ip=0.0.0.0 --allow-root
docker exec -it p36tf115 jupyter notebook list
docker run -itd --name p36lab -p 8888:8888 -v /usr/share/website/P36Lab:/projects python:3.6
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
pip install jupyterlab
docker exec -itd p36lab jupyter lab --allow-root --autoreload --ip="0.0.0.0" --port=8888
docker exec -it p36lab jupyter server list
b6bf31cf85638c9a276efb04c1b455c888af2f81590ec315
# docker run -itd -p 6379:6379 -v /root/redis/config:/etc/redis -v /root/redis/data:/data -v /root/redis/log:/var/log/redis -v /root/redis/lib:/var/lib/redis --name redis redis redis-server /etc/redis/redis.conf --appendonly yes
docker run -itd -p 6379:6379 -v /root/redis:/data --name redis redis redis-server /data/config/redis.conf
# Nginx
docker run -itd --name ContentSite -p 80:80 -p 443:443 -v /usr/share/website/ContentSite/nginx:/etc/nginx -v /usr/share/website/ContentSite/dist:/usr/share/nginx/html -v /usr/share/website/ContentSite/nginx/log:/var/log/nginx nginx:latest /bin/bash
docker run -d --name WebRunner0 -v /usr/share/website/gitlab:/gitlab gitlab/gitlab-runner
git remote set-url --add origin `address`
# macOS
netstat -a -n | grep $port