对照表

linux命令

apt-get

替换国内源

echo "" > /etc/apt/sources.list
echo "deb https://mirrors.aliyun.com/debian stable main contrib non-free">>/etc/apt/sources.list
echo "deb https://mirrors.aliyun.com/debian stable-updates main contrib non-free">>/etc/apt/sources.list
apt-get clean
apt-get update
apt-get upgrade -y

docker

build

$ docker build -t localhost/python/3.12:latest -f Dockerfile-3.12 /home/user/images/python

push

$ docker push registry.example.com:5000/repo/image:latest

git

git pull

ansible: https://docs.ansible.com/ansible/latest/collections/ansible/builtin/git_module.html#ansible-collections-ansible-builtin-git-module

tasks:
  - name: Git拉取代码(clone和pull)
    ansible.builtin.git:
      repo: 'git@gitee.com:luzhenxiong/paradox-playground.git'
      dest: '{{ base_path }}'
      # 如果目录不存在执行git clone
      clone: true
      # 检测revisions, 存在差异执行git pull
      update: true
      # 指定master分支
      version: master
    notify:
      - 收集静态资源

警告

command命令执行git pull的弊端: 总是显示changed。因为每次执行git pull返回 Already up to date. 这在ansible看来是属于存在变更。

关联远程仓库

git remote add origin https://paradox@git.xxxx.com.cn/scm/~paradox/proj.git

git stash

https://git-scm.com/docs/git-stash

todo

submodule

https://git-scm.com/docs/gitsubmodules#_workflow_for_an_artificially_split_repo

supervisorctl

ansible使用supervisor模块的前提是supervisord已启动

https://docs.ansible.com/ansible/latest/collections/community/general/supervisorctl_module.html#ansible-collections-community-general-supervisorctl-module

start

> supervisorctl start my_app

restart

重启所有进程

> supervisorctl restart all