meaningful / ecs_sclm Goto Github PK
View Code? Open in Web Editor NEWthe code in our ecs server
the code in our ecs server
项目管理: 代码仓库中存在冗余文件: .pyc 编译的文件, 还有部分的Media 文件 。 在本机上找出所有的.pyc 文件使用find 命令: find ./ -name ".pyc"
如果需要删除找出来的所有pyc 文件,在搜索文件命令后面加上移除的命令, 如下:find ./ -name ".pyc" |xargs rm -rf
如何移除代码仓库中冗余的文件(比如*.pyc) :
可先直接在文件管理器中把要删除的文件夹删掉(以WEB-INF文件夹为例)
$ git add --all
$ git commit -m "XXXX"
$ git push -u origin master
git add -A(--all):表示把所有tracked文件中被修改过或已删除文件和所有untracted的文件信息添加到索引库。
整体来说项目的部署使用 supervisor + uwsgi +nginx +virtualenv 来运行。
以前的项目未采用virtualenv , 最近考虑使用virtualenv 。 然后遇到了问题。
首先uwsgi 应该是virtualenv的一部分, 在source activate 进入虚拟环境之后再安装uwsgi . 检查uwsgi的版本为:
(venv) root@liujie-Aspire-5830TG:/home/liujie/PycharmProjects/zhifu# uwsgi --version
2.0.17
然后在系统中也有一个uwsgi : 版本为:
root@liujie-Aspire-5830TG:/etc/supervisor# uwsgi --version
2.0.15
可以看到这两个uwsgi 版本是不一样的。 如果在进入虚拟环境之后使用命令启动uwsgi --ini uwsgiconfigfile.ini 看到的uwsgi日志为:
*** Starting **uWSGI 2.0.17 (64bit)** on [Fri Mar 23 11:46:51 2018] *** compiled with version: 5.4.0 20160609 on 20 March 2018 09:29:54 os: Linux-4.4.0-38-generic #57-Ubuntu SMP Tue Sep 6 15:42:33 UTC 2016 nodename: liujie-Aspire-5830TG machine: x86_64 clock source: unix pcre jit disabled detected number of CPU cores: 4 current working directory: /home/liujie/PycharmProjects/zhifu writing pidfile to /home/liujie/PycharmProjects/zhifu/uwsgi_sclm.pid detected binary path: /home/liujie/PycharmProjects/zhifu/venv/bin/uwsgi uWSGI running as root, you can use --uid/--gid/--chroot options *** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** chdir() to /home/liujie/PycharmProjects/zhifu your processes number limit is 15027 limiting address space of processes... your process address space limit is 536870912 bytes (512 MB) your memory page size is 4096 bytes detected max file descriptor number: 1024 VirtualHosting mode enabled. lock engine: pthread robust mutexes
但是使用supervisor 启动uwsgi之后进入的不是虚拟机中的uwsgi , 尽管在配置中已经指定了uwsgi为虚拟机路径:
[program:zhifu]
command=/home/liujie/PycharmProjects/zhifu/venv/bin/uwsgi --ini uwsgi.ini
environment=DJANGO_SETTINGS_MODULE='zhifu.settings'
directory=/home/liujie/PycharmProjects/zhifu/
autostart=true
user=root
得到的日志为:
*** Starting uWSGI 2.0.15 (64bit) on [Fri Mar 23 11:47:55 2018] ***
compiled with version: 5.4.0 20160609 on 01 July 2017 19:03:54
os: Linux-4.4.0-38-generic #57-Ubuntu SMP Tue Sep 6 15:42:33 UTC 2016
nodename: liujie-Aspire-5830TG
machine: x86_64
clock source: unix
detected number of CPU cores: 4
current working directory: /home/liujie/PycharmProjects/zhifu
writing pidfile to /home/liujie/PycharmProjects/zhifu/uwsgi_sclm.pid
detected binary path: /usr/local/bin/uwsgi
!!! no internal routing support, rebuild with pcre support !!!
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
chdir() to /home/liujie/PycharmProjects/zhifu
your processes number limit is 15027
limiting address space of processes...
your process address space limit is 536870912 bytes (512 MB)
如何将supervisor 启动的uwsgi定位为虚拟环境中的uwsgi ?
难道只能在虚拟环境中再安装一个supervisor ? 如果这样安装了, supervisor 是否能被系统检测使用?
不知道大家有没有好的方法可以解决这个问题。
在这里填写:此issues 更新数据库相关的信息
几个数据库相关的指令:
1.1 远程登录mysql : mysql -u root -P3306 -h【ip地址】 -p
1.2 从sql文件中还原表信息: source /root/WorkSpace/agent.sql
本地文件上传至ecs服务器:
2.1上传文件: scp agent.sql authinfo.sql root@【ip地址】:WorkSpace/
2.2 上传目录: scp -r ./suit root@【IP地址】:WorkSpace/sclmknowledge/extra-apps
确认服务器端口是否通 。
3.1 使用ping 只能确认ip是否联通。
3.2 使用 wget IP:Port 可以确认端口。
记录任务 和 任务的完成情况:
2017年08月26日: 完成甲方提供的ECS服务器 (IP: 120.XX.XX.10) 上环境的搭建, 包括:nginx , uwsgi , supervisor . 完成配置。 先可以访问http://120.XX.XX.10:1024/admin/ 查看效果
下面是一个悬而未解的问题: sudo apt-get upgrade 就会报这个错, 然后不能正常的安装virtualenv 。
The following packages have been kept back:
libdrm2
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up uwsgi (2.0.12-5ubuntu3.1) ...
Job for uwsgi.service failed because the control process exited with error code. See "systemctl status uwsgi.service" and "journalctl -xe" for details.
invoke-rc.d: initscript uwsgi, action "start" failed.
● uwsgi.service - LSB: Start/stop uWSGI server instance(s)
Loaded: loaded (/etc/init.d/uwsgi; bad; vendor preset: enabled)
Active: failed (Result: exit-code) since Sat 2018-03-24 14:42:56 CST; 5ms ago
Docs: man:systemd-sysv-generator(8)
Process: 13045 ExecStart=/etc/init.d/uwsgi start (code=exited, status=1/FAILURE)
Mar 24 14:42:56 iZ2ze2rdwfbgbl9jw0wwqvZ systemd[1]: Starting LSB: Start/stop uWSGI server instance(s)...
Mar 24 14:42:56 iZ2ze2rdwfbgbl9jw0wwqvZ uwsgi[13045]: * Starting app server(s) uwsgi
Mar 24 14:42:56 iZ2ze2rdwfbgbl9jw0wwqvZ uwsgi[13045]: ...fail!
Mar 24 14:42:56 iZ2ze2rdwfbgbl9jw0wwqvZ systemd[1]: uwsgi.service: Control process exited, code=exited status=1
Mar 24 14:42:56 iZ2ze2rdwfbgbl9jw0wwqvZ systemd[1]: Failed to start LSB: Start/stop uWSGI server instance(s).
Mar 24 14:42:56 iZ2ze2rdwfbgbl9jw0wwqvZ systemd[1]: uwsgi.service: Unit entered failed state.
Mar 24 14:42:56 iZ2ze2rdwfbgbl9jw0wwqvZ systemd[1]: uwsgi.service: Failed with result 'exit-code'.
dpkg: error processing package uwsgi (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
uwsgi
E: Sub-process /usr/bin/dpkg returned an error code (1)
还有个特别奇怪的地方, 安装的virtualenv 不能被正常的调用起来。 pip list 可以看到:
virtualenv (15.0.1)
但是运行virtualenv 命令的时候却提示:
root@iZ2ze2rdwfbgbl9jw0wwqvZ:~# virtualenv
The program 'virtualenv' is currently not installed. You can install it by typing:
apt install virtualenv
liujie@liujie-Aspire-5830TG:/etc$ virtualenv
You must provide a DEST_DIR
Usage: virtualenv [OPTIONS] DEST_DIR
Options:
--version show program's version number and exit
-h, --help show this help message and exit
-v, --verbose Increase verbosity.
-q, --quiet Decrease verbosity.
-p PYTHON_EXE, --python=PYTHON_EXE
The Python interpreter to use, e.g.,
--python=python2.5 will use the python2.5 interpreter
to create the new environment. The default is the
interpreter that virtualenv was installed with
(/usr/bin/python2.7)
--clear Clear out the non-root install and start from scratch.
--no-site-packages DEPRECATED. Retained only for backward compatibility.
Not having access to global site-packages is now the
default behavior.
--system-site-packages
Give the virtual environment access to the global
已经向陈老师求救, 待解答。
自从开始玩linux 系统, 我觉得自己的耐心和毅力得到了长足的进步.....
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.