網頁

2021年11月22日 星期一

gitea on QNAP (設定 Auto Start, CPU Memory 限制)

參考: http://qnap-dev.github.io/container-station-api/index.html
因為使用 QNAP 的 container station api, 不能使用 QNAP 的 2-step verification

[/share/Dockers/gitea] # cat 0_run.sh
#mkdir -p data/git
#mkdir -p data/gitea

docker run -d --name=gitea \
-p 10022:22 -p 3000:3000 \
-v /share/Dockers/gitea/data/gitea:/data/gitea \
-v /share/Dockers/gitea/data/git:/data/git \
gitea/gitea:latest

[/share/Dockers/gitea] # cat cs_get.sh
CONTAINER_ID=$(docker ps -qf "name=gitea")
echo ${CONTAINER_ID}
CONTAINER_ID=$(cd /var/lib/docker/containers && ls -d ${CONTAINER_ID}*)
echo ${CONTAINER_ID}
QIP=127.0.0.1
QPORT=8080
curl -sq -XPOST -c cookies.txt -d '{"username": "admin", "password": "password"}' http://${QIP}:${QPORT}/container-station/api/v1/login
curl -sq -XGET -b cookies.txt http://${QIP}:${QPORT}/container-station/api/v1/container/docker/${CONTAINER_ID}/all

[/share/Dockers/gitea] # cat cs_set.sh
CONTAINER_ID=$(docker ps -qf "name=gitea")
echo ${CONTAINER_ID}
CONTAINER_ID=$(cd /var/lib/docker/containers && ls -d ${CONTAINER_ID}*)
echo ${CONTAINER_ID}
QIP=127.0.0.1
QPORT=8080
curl -sq -XPOST -c cookies.txt -d '{"username": "admin", "password": "password"}' http://${QIP}:${QPORT}/container-station/api/v1/login
curl -sq -XPUT -b cookies.txt http://${QIP}:${QPORT}/container-station/api/v1/container/docker/${CONTAINER_ID}/autostart/on
curl -sq -XPOST -b cookies.txt -d \
    '{
        "cputime": 500,
        "memory": "1024m"
    }' http://${QIP}:${QPORT}/container-station/api/v1/container/docker/${CONTAINER_ID}/resource/limit

沒有留言:

張貼留言