- 配置
sh script/install_*
virtualenv venv
venv/bin/python main.py
-
config
目录下新建oss.yaml
oss: Auth: AccessKeyId: XXXXXXXXXX AccessKeySecret: XXXXXXXXXXX Bucket: EndPoint: XXXXXXXXXXX BucketName: XXXXXXXXXXXX
vim /etc/resolvconf/resolv.conf.d/base
-
创建user
useradd -m chunibyo # -m 创建/home目录
-
设置user密码
passwd chunibyo
-
删除user
userdel chunibyo
-
创建group
groupadd test_group
-
删除group
groupdel test_group
-
添加user到group
usermod -G test_group chunibyo
-
删除user从group
gpasswd -d chunibyo test_group
docker run --name some-mysql --restart=always -e MYSQL_ROOT_PASSWORD=foo -d mysql:latest
docker run --name some-nginx --restart=unless-stopped -d nginx
docker run --name some-redis --restart=unless-stopped -d redis
4.1 SonarQube
-
MySQL建库
create database sonarqube character set utf8 collate utf8_general_ci;
-
建立
sonar
用户(因为mysql在容器里面并且没有开放端口, 所以直接监听公网最方便)create user 'sonar'@'%' identified by 'foo'; grant all privileges on sonar.* to 'sonar'@'%' ; flush privileges;
-
安装sonar
-
打包成service
/lib/systemd/system/sonar.service [Unit] Description=SonarQube service After=syslog.target network.target [Service] Type=forking ExecStart=/opt/sonarqube/bin/linux-x86-64/sonar.sh start ExecStop=/opt/sonarqube/bin/linux-x86-64/sonar.sh stop User=sonar Group=sonar Restart=always LimitNOFILE=65536 LimitNPROC=4096 [Install] WantedBy=multi-user.target
apt
仓库默认安装
---
- hosts: cugergz.chunibyo.xyz
vars:
repo_folder: /root/Panel
remote_user: root
tasks:
- name: "Create directory if not exists"
file:
path: "{{ repo_folder }}"
state: directory
mode: 0755
group: root
owner: root
- name: kill old process
shell: ps aux | grep main.p[y] | awk '{print $2}' | xargs kill
ignore_errors: true
- name: clone repository
git:
repo: https://github.com/chunibyo-wly/LinuxControlPanel.git
dest: "{{ repo_folder }}"
update: yes
force: yes
- name: create python virtualenv
pip:
requirements: "{{ repo_folder }}/requirements.txt"
virtualenv: "{{ repo_folder }}/venv"
virtualenv_command: /usr/bin/python3 -m venv
- name: install ftp
shell: "sh {{ repo_folder }}/script/install_ftp.sh"
- name: install nginx
shell: "sh {{ repo_folder }}/script/install_nginx.sh"
- name: install cron
shell: "sh {{ repo_folder }}/script/install_crontab.sh"
- name: create database
shell: "cd {{ repo_folder }} && sudo venv/bin/python db/init.py"
- name: start server
shell: "cd {{ repo_folder }} && nohup sudo {{ repo_folder }}/venv/bin/python main.py > /tmp/LinuxControlPanel.log 2>&1 &"