print("I am ai robot start up command line for server")
var installShell = """
shell:# lsb_release -a
After running docker build, everything succeed, then
docker run --name dkName -p 8080:8080 appName
// the ip addr for application
docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' appName
// run docker container bash
docker exec -it /dkName /bin/bash
// start nginx
service nginx restart
//config for nginx
vi /etc/nginx/sites-enabled/default
// check nginx configuration
nginx -t
server {
server_name 47.108.188.2222;
listen 80;
#root /root/ai-vapor;
location / {
proxy_pass http://172.18.0.2:8080; // the docker get ip address
proxy_pass_header Server;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_connect_timeout 3s;
proxy_read_timeout 10s;
}
}
// see the docker container logs
docker logs dkName
// see nginx logs
tail /var/log/nginx/error.log
//important the dns must add
app txt ip_addr in dns
// First update or add new dns
ns1.alidns.com
docker tag your_local_image:tag awesome2023/vapor:tag
# Remove each tag one by one
docker rmi IMAGE_NAME:TAG1
docker pull awesome2023/vapor:0.02
// check dns using dig
$dig app.domain txt
server {
server_name app.domain.online; #update domain
listen 80;
#root /root/ai-path;
location @proxy {
return 301 https://$host$request_uri;
}
}
server {
listen 443 ssl;
server_name app.domain.online; #update domain
ssl_certificate /root/app-site-cert/path.crt;
ssl_certificate_key /root/app-site-cert/app.path.key;
location / {
proxy_pass http://172.18.0.2:8080; #change ip and port
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
socks default 443 port access by wss://app.domain.online/songs/socks
And remove ip access dir, figer out how to.
docker exec -e VARIABLE_NAME=variable_value container_id_or_name command_to_run
docker exec -it container_id_or_name /bin/bash
export VARIABLE_NAME=variable_value
// rebuild os
docker build -t yt-xx-api .
docker stop aivapor
docker remove aivapor
docker ps
docker run -e DATABASE_URL=postgres://kcwqvtuz:IzSq7ql.com/kcwqvtuz --name aivapor -p 8080:8080 -d --rm yt-xx-api
docker start aivapor
linux install python env,
python3.10 -m venv gradio-env
source gradio-env/bin/activate
pip3.10 uninstall gradio
nginx config loaded file, /lib/systemd/system/nginx.service
(gradio-env) root@iZ2vccodzbwlyclb9j2bpyZ:
uvicorn api:app --host 0.0.0.0 --port 7860 --reload
"""
print(installShell)
docker run -e DATABASE_URL=postgres://kcwqvtuz:IzSq7bW3xmXBNGEkQPndkwJsnhlAxgU2@john.db.elephantsql.com/kcwqvtuz --name aivapor -p 8080:8080 yt-vapor-api
476 docker run -e DATABASE_URL=postgres://kcwqvtuz:IzSq7bW3xmXBNGEkQPndkwJsnhlAxgU2@john.db.elephantsql.com/kcwqvtuz -d --rm --name aivapor -p 8080:8080 yt-vapor-api
477 docker run -e DATABASE_URL=postgres://kcwqvtuz:IzSq7bW3xmXBNGEkQPndkwJsnhlAxgU2@john.db.elephantsql.com/kcwqvtuz --rm --name aivapor -p 8080:8080 yt-vapor-api
478 docker run -e DATABASE_URL=postgres://kcwqvtuz:IzSq7bW3xmXBNGEkQPndkwJsnhlAxgU2@john.db.elephantsql.com/kcwqvtuz --name aivapor -p 8080:8080 -d --rm yt-vapor-api
479 docker ps
480 docker start aivapor
481 docker logs aivapor
482 docker
483 docker start aivapor
484 docker logs aivapor
485 docker ps
486 tail /var/log/nginx/error.log
487 ls
488 cd ai-vapor/
489 git pull origin develop
490 git log
491 clear
492 docker build -t yt-vapor-api .
493 docker stop aivapor
494 docker remove aivapor
495 docker ps
496 docker run -e DATABASE_URL=postgres://kcwqvtuz:IzSq7bW3xmXBNGEkQPndkwJsnhlAxgU2@john.db.elephantsql.com/kcwqvtuz --name aivapor -p 8080:8080 -d --rm yt-vapor-api
497 docker ps
Aliyun trouble shooting:
=> CANCELED [internal] load metadata for docker.io/library/swift:5.8-focal-slim 32.2s
=> ERROR [internal] load metadata for docker.io/library/swift:5.8-focal
https://stackoverflow.com/questions/73812700/docker-error-internal-load-metadata-for-docker-io
export DOCKER_BUILDKIT=0
[Tue Nov 19 07:52:41 PM CST 2024] Installing to /root/.acme.sh
[Tue Nov 19 07:52:41 PM CST 2024] Installed to /root/.acme.sh/acme.sh
[Tue Nov 19 07:52:41 PM CST 2024] Installing alias to '/root/.bashrc'
[Tue Nov 19 07:52:41 PM CST 2024] Close and reopen your terminal to start using acme.sh
[Tue Nov 19 07:52:41 PM CST 2024] Installing cron job
install acme.sh
curl https://get.acme.sh | sh -s email=k-night@163.com
[Tue Nov 19 07:55:11 PM CST 2024] Cert success.
-----BEGIN CERTIFICATE-----
MIID2zCCA4GgAwIBAgIQUQEUAZjjiw7mbAW/8sPg0jAKBggqhkjOPQQDAjBZMQsw
CQYDVQQGEwJDTjElMCMGA1UEChMcVHJ1c3RBc2lhIFRlY2hub2xvZ2llcywgSW5j
LjEjMCEGA1UEAxMaVHJ1c3RBc2lhIEVDQyBEViBUTFMgQ0EgRzMwHhcNMjQxMTE5
MDAwMDAwWhcNMjUwMjE3MjM1OTU5WjAWMRQwEgYDVQQDEwtraXNzYWJjLmZ1bjBZ
MBMGByqGSM49AgEGCCqGSM49AwEHA0IABOrK/RiQ0vOxwvxsfjs8e0ReH7OE3B34
u5bZSOpoQlU/Q5zf4U57hTk+R3aTQ+WebgpltNPF7z/hmlc2l0ym3QWjggJsMIIC
aDAfBgNVHSMEGDAWgBTCG5ffIsVQ0TiBA21X04YgpW4AVjAdBgNVHQ4EFgQUxFU9
pnFeu76WHuSKmduCwO6tRV4wDgYDVR0PAQH/BAQDAgeAMAwGA1UdEwEB/wQCMAAw
HQYDVR0lBBYwFAYIKwYBBQUHAwEGCCsGAQUFBwMCMEkGA1UdIARCMEAwNAYLKwYB
BAGyMQECAjEwJTAjBggrBgEFBQcCARYXaHR0cHM6Ly9zZWN0aWdvLmNvbS9DUFMw
CAYGZ4EMAQIBMH0GCCsGAQUFBwEBBHEwbzBCBggrBgEFBQcwAoY2aHR0cDovL2Ny
dC50cnVzdC1wcm92aWRlci5jbi9UcnVzdEFzaWFFQ0NEVlRMU0NBRzMuY3J0MCkG
CCsGAQUFBzABhh1odHRwOi8vb2NzcC50cnVzdC1wcm92aWRlci5jbjCCAQUGCisG
AQQB1nkCBAIEgfYEgfMA8QB2AM8RVu7VLnyv84db2Wkum+kacWdKsBfsrAHSW3fO
zDsIAAABk0RGlJsAAAQDAEcwRQIhAO3R7TmyBKrPE1mB8oAmU9qtmeYEP5QW1s/J
tTc4zHBHAiAy5F/4uhPAIFNzLml9wFyjmp6xJN0DJ3G+CabnI/AMuAB3AMz7D2qF
cQll/pWbU87psnwi6YVcDZeNtql+VMD+TA2wAAABk0RGlGgAAAQDAEgwRgIhAI57
4BneCfyPeHHyslnUrrkWLxT1iAtytbqvbbVCfblVAiEA9QUWjO0hH2wCdPIaL0G8
Jtn01YB637WyZgBXGAOGWy8wFgYDVR0RBA8wDYILa2lzc2FiYy5mdW4wCgYIKoZI
zj0EAwIDSAAwRQIhAMQrDw9+AXhI2PqQEcBkNNcAWU3uvf64/+1XKlKEW0ymAiAb
7Fjeti6+npBhve6kGYkMzlmzhpvX29nnuhPJwz1hTQ==
-----END CERTIFICATE-----
[Tue Nov 19 07:55:11 PM CST 2024] Your cert is in: /root/.acme.sh/kissabc.fun_ecc/kissabc.fun.cer
[Tue Nov 19 07:55:11 PM CST 2024] Your cert key is in: /root/.acme.sh/kissabc.fun_ecc/kissabc.fun.key
[Tue Nov 19 07:55:11 PM CST 2024] The intermediate CA cert is in: /root/.acme.sh/kissabc.fun_ecc/ca.cer
[Tue Nov 19 07:55:11 PM CST 2024] And the full-chain cert is in: /root/.acme.sh/kissabc.fun_ecc/fullchain.cer