Skip to content

Instantly share code, notes, and snippets.

@ShilGen
Last active June 13, 2024 17:00
Show Gist options
  • Save ShilGen/4736422b1b3fdb657652510dc8b53528 to your computer and use it in GitHub Desktop.
Save ShilGen/4736422b1b3fdb657652510dc8b53528 to your computer and use it in GitHub Desktop.

Обновление репозитариев

apt-get update

Проверка версии Python

python3 --version
>.vimrc
vim .vimrc

Установка сервера Apache2

sudo apt-get install apache2 libapache2-mod-wsgi-py3

Установка пакетного менеджера pip

wget https://bootstrap.pypa.io/get-pip.py
python3 get-pip.py
python3 -m pip --version

Включение записи истории команд в терминале

vim .bashrc 
echo $HISTFILE
echo $HISTCONTROL
vim .bash_history
shopt -s
history -a
>.bash_history

Создание папки проекта

mkdir /app
mkdir /app/log
vim log/error.log 

Apache2

cd /etc/apache2/sites-available/ 
cp 000-default.conf 000-default-copy.conf
systemctl enable apache2
a2enmod proxy_http
systemctl stop apache2
systemctl start apache2
systemctl status apache2

Pip

pip3 install Flask
pip3 install --ignore-installed Flask

pip3 install flask-sock
pip3 install gunicorn
gunicorn -b :5001 --workers 4 --threads 100 app:app
pip3 freeze

Git

git init
vim .gitignore 
git add .gitignore 
git status
git log --reflog

Gunicorn

which gunicorn
cd /etc/systemd/system
>gunicorn.service
vim gunicorn.service 
>gunicorn.socket
vim gunicorn.socket 
systemd-analyze verify gunicorn.service
sudo systemctl enable gunicorn
sudo systemctl start gunicorn
sudo systemctl restart gunicorn
service gunicorn stop
systemctl daemon-reload
apt-get update
pwd
ls -la
vim .profile
ls -la
>.vimrc
vim .vimrc
python3 --version
sudo apt-get install apache2 libapache2-mod-wsgi-py3
python3 -m pip --version
wget https://bootstrap.pypa.io/get-pip.py
python3 get-pip.py
python3 -m pip --version
ды -дф
ls -la
vim .bashrc
echo $HISTFILE
pwd
vim /root/.bash_history
>.bash_history
ls
ls -la
echo $HISTCONTROL
vim .bashrc
ls
ls -la
vim .bashrc
echo $HISTCONTROL
shopt -s
history -a
echo $HISTCONTROL
ls -la
vim .bash_history
cd ..
pwd
mkdir app
ls
cd /app
ls
clear
git status
>app.py
vim app.py
cd /etc/apache2/sites-available/
ls
cp 000-default.conf 000-default-copy.conf
vim 000-default.conf
cd /app
mkdir log
ls
>server.wsgi
vim server.wsgi
systemctl enable apache2
a2enmod proxy_http
systemctl stop apache2
systemctl statu apache2
systemctl status apache2
systemctl start apache2
systemctl status apache2
ls
cd log
ls
vim error.log
pip3 install Flask
systemctl restart apache2
vim error.log
pip3 freezy
pip3 freeze
pip install -U Flask
pip install --ignored-installed Flask
pip3 install --ignored-installed Flask
clear
pip3 install Flask --force
pip3 install blinker
pip3 install Flask
pip3 install --ignored-installed Flask
pip3 install --ignore-installed Flask
systemctl restart apache2
clear
cd ..
ls -la
pip3 install flask-sock
clear
git status
git init
git status
git add app.py
>.gitignore
vim .gitignore
clear
git status
git add .gitignore
git add server.wsgi
git status
git commit -m "v0.1 It's workgit status!"
clear
git status
clear
vim app.py
clear
pip3 freeze
clea
clear
git status
git add app.py
systemctl restart apache2
clear
git status
git list
git log --reflog
git diff app.py
cat app.py
git commit -m "v0.2 def reverse"
git status
clear
pip3 freeze
clear
systemctl restart apache2
cd /log
cd log
ls
vim error.log
cd ..q
cd ..
clear
git status
clear
vim log/error.log
vim /etc/apache2/sites-available/000-default.conf
apt-get install websocketd
>ws.sh
vim ws.sh
chmod +x ws.sh
ls -la
./ws.sh
vim ws.sh
./ws.sh
vim ws.sh
./ws.sh
vim ws.sh
./ws.sh
pip3 install gunicorn
vim /etc/apache2/sites-available/000-default.conf
clear
gunicorn -b :5001 --workers 4 --threads 100 app:app
clear
git status
rm ws.sh
vim .gitignore
git add .gitignore
gitstatus
git status
git commit -m "add pycache"
clear
git status
clear
git log
mkdir templates
cd templates/
>index.html
vim index.html
cd ..
vim app.py
systemctl restart apache2
gunicorn -b :5001 --workers 4 --threads 100 app:app
clear
git status
git add app.py templates/index.html
git status
git log
git commit -m "v0.3 add index.html"
clear
git status
clear
cd /etc/systemd/system
>gunicorn.service
vim gunicorn.service
>gunicorn.socket
vim gunicorn.socket
systemd-analyze verify gunicorn.service
sudo systemctl enable gunicorn
sudo systemctl start gunicorn
systemctl restart apache2
ls
ls -la
cat gunicorn.service
vim gunicorn.service
systemd-analyze verify gunicorn.service
sudo systemctl restart gunicorn
systemctl daemon-reload
sudo systemctl restart gunicorn
systemctl restart apache2
service gunicorn restart
systemctl status gunicorn
vim gunicorn.service
service gunicorn stop
systemd-analyze verify gunicorn.service
systemctl daemon-reload
service gunicorn start
systemctl status gunicorn
which gunicorn
vim gunicorn.service
service gunicorn stop
systemd-analyze verify gunicorn.service
systemctl daemon-reload
service gunicorn start
systemctl restart apache2
systemctl status gunicorn
cat gunicorn.service
/usr/local/bin/gunicorn -b 194.226.49.31:5001 --workers 4 --threads 100 app:app
/usr/local/bin/gunicorn -b :5001 --workers 4 --threads 100 app:app
gunicorn -b :5001 --workers 4 --threads 100 app:app
vim /run/gunicorn.sock
sudo vim /run/gunicorn.sock
gunicorn -b :5001 --workers 4 --threads 100 app:app
cd /app
gunicorn -b :5001 --workers 4 --threads 100 app:app
cd /
gunicorn -b :5001 --workers 4 --threads 100 app:/app
/usr/local/bin/gunicorn -b 194.226.49.31:5001 --workers 4 --threads 100 app:/app
/usr/local/bin/gunicorn -b :5001 --workers 4 --threads 100 app:/app
/usr/local/bin/gunicorn -b :5001 --workers 4 --threads 100 app:/app/server.wsgi
cd /app
/usr/local/bin/gunicorn -b :5001 --workers 4 --threads 100 app:/app/
/usr/local/bin/gunicorn -b :5001 --workers 4 --threads 100 app:app
gunicorn -b :5001 --workers 4 --threads 100 app:app
gunicorn -b :5001 --workers 4 --threads 100 app:/app
gunicorn -b :5001 --workers 4 --threads 100 app:app
systemctl status gunicorn
systemctl restart apache2
systemctl status gunicorn
service gunicorn stop
gunicorn -b :5001 --workers 4 --threads 100 app:app
service gunicorn stop
systemctl restart apache2
systemctl status gunicorn
gunicorn -b :5001 --workers 4 --threads 100 app:app
apt-get update
pwd
ls -la
vim .profile
ls -la
>.vimrc
vim .vimrc
python3 --version
sudo apt-get install apache2 libapache2-mod-wsgi-py3
python3 -m pip --version
wget https://bootstrap.pypa.io/get-pip.py
python3 get-pip.py
python3 -m pip --version
ды -дф
ls -la
vim .bashrc
echo $HISTFILE
pwd
vim /root/.bash_history
>.bash_history
ls
ls -la
echo $HISTCONTROL
vim .bashrc
ls
ls -la
vim .bashrc
echo $HISTCONTROL
shopt -s
history -a
echo $HISTCONTROL
ls -la
vim .bash_history
cd ..
pwd
mkdir app
ls
cd /app
ls
clear
git status
>app.py
vim app.py
cd /etc/apache2/sites-available/
ls
cp 000-default.conf 000-default-copy.conf
vim 000-default.conf
cd /app
mkdir log
ls
>server.wsgi
vim server.wsgi
systemctl enable apache2
a2enmod proxy_http
systemctl stop apache2
systemctl statu apache2
systemctl status apache2
systemctl start apache2
systemctl status apache2
ls
cd log
ls
vim error.log
pip3 install Flask
systemctl restart apache2
vim error.log
pip3 freezy
pip3 freeze
pip install -U Flask
pip install --ignored-installed Flask
pip3 install --ignored-installed Flask
clear
pip3 install Flask --force
pip3 install blinker
pip3 install Flask
pip3 install --ignored-installed Flask
pip3 install --ignore-installed Flask
systemctl restart apache2
clear
cd ..
ls -la
pip3 install flask-sock
clear
git status
git init
git status
git add app.py
>.gitignore
vim .gitignore
clear
git status
git add .gitignore
git add server.wsgi
git status
git commit -m "v0.1 It's workgit status!"
clear
git status
clear
vim app.py
clear
pip3 freeze
clea
clear
git status
git add app.py
systemctl restart apache2
clear
git status
git list
git log --reflog
git diff app.py
cat app.py
git commit -m "v0.2 def reverse"
git status
clear
pip3 freeze
clear
systemctl restart apache2
cd /log
cd log
ls
vim error.log
cd ..q
cd ..
clear
git status
clear
vim log/error.log
vim /etc/apache2/sites-available/000-default.conf
apt-get install websocketd
>ws.sh
vim ws.sh
chmod +x ws.sh
ls -la
./ws.sh
vim ws.sh
./ws.sh
vim ws.sh
./ws.sh
vim ws.sh
./ws.sh
pip3 install gunicorn
vim /etc/apache2/sites-available/000-default.conf
clear
gunicorn -b :5001 --workers 4 --threads 100 app:app
clear
git status
rm ws.sh
vim .gitignore
git add .gitignore
gitstatus
git status
git commit -m "add pycache"
clear
git status
clear
git log
mkdir templates
cd templates/
>index.html
vim index.html
cd ..
vim app.py
systemctl restart apache2
gunicorn -b :5001 --workers 4 --threads 100 app:app
clear
git status
git add app.py templates/index.html
git status
git log
git commit -m "v0.3 add index.html"
clear
git status
clear
cd /etc/systemd/system
>gunicorn.service
vim gunicorn.service
>gunicorn.socket
vim gunicorn.socket
systemd-analyze verify gunicorn.service
sudo systemctl enable gunicorn
sudo systemctl start gunicorn
systemctl restart apache2
ls
ls -la
cat gunicorn.service
vim gunicorn.service
systemd-analyze verify gunicorn.service
sudo systemctl restart gunicorn
systemctl daemon-reload
sudo systemctl restart gunicorn
systemctl restart apache2
service gunicorn restart
systemctl status gunicorn
vim gunicorn.service
service gunicorn stop
systemd-analyze verify gunicorn.service
systemctl daemon-reload
service gunicorn start
systemctl status gunicorn
which gunicorn
vim gunicorn.service
service gunicorn stop
systemd-analyze verify gunicorn.service
systemctl daemon-reload
service gunicorn start
systemctl restart apache2
systemctl status gunicorn
cat gunicorn.service
/usr/local/bin/gunicorn -b 194.226.49.31:5001 --workers 4 --threads 100 app:app
/usr/local/bin/gunicorn -b :5001 --workers 4 --threads 100 app:app
gunicorn -b :5001 --workers 4 --threads 100 app:app
vim /run/gunicorn.sock
sudo vim /run/gunicorn.sock
gunicorn -b :5001 --workers 4 --threads 100 app:app
cd /app
gunicorn -b :5001 --workers 4 --threads 100 app:app
cd /
gunicorn -b :5001 --workers 4 --threads 100 app:/app
/usr/local/bin/gunicorn -b 194.226.49.31:5001 --workers 4 --threads 100 app:/app
/usr/local/bin/gunicorn -b :5001 --workers 4 --threads 100 app:/app
/usr/local/bin/gunicorn -b :5001 --workers 4 --threads 100 app:/app/server.wsgi
cd /app
/usr/local/bin/gunicorn -b :5001 --workers 4 --threads 100 app:/app/
/usr/local/bin/gunicorn -b :5001 --workers 4 --threads 100 app:app
gunicorn -b :5001 --workers 4 --threads 100 app:app
gunicorn -b :5001 --workers 4 --threads 100 app:/app
gunicorn -b :5001 --workers 4 --threads 100 app:app
systemctl status gunicorn
systemctl restart apache2
systemctl status gunicorn
service gunicorn stop
gunicorn -b :5001 --workers 4 --threads 100 app:app
service gunicorn stop
systemctl restart apache2
systemctl status gunicorn
gunicorn -b :5001 --workers 4 --threads 100 app:app
systemctl status gunicorn
clear
cd /app
git remote add origin git@github.com:ShilGen/flask_sock_example.git
git push origin master
ssh-keygen -t ed25519 -C "geniusshil@gmail.com"
cat ~/.ssh/id_ed25519.pub
git push origin master
>README.md
cd /etc/systemd/system
ls
vim gunicorn.service
vim gunicorn.socket
cd /etc/apache2/sites-enabled/
ls
vim 000-default.conf
clear
git status
cd /app
git status
git add README.md
git commit -m "add config files out of project"
git push origin master
clear
cd ~
cat .bash_history
cd /app
clear
vim README.md
git add README.md
git commit -m "add gist link"
git push origin master
history
which gunicorn
cat gunicorn.service
cat /etc/systemd/system/gunicorn.service
ls /app/
history | grep guni
ps axu|grep guni
which gunicorn
ps aux|grep www
cat /etc/group
cd /etc/systemd/system/
ls
systemctl status gunicorn.service
ls /usr/local/bin/gunicorn:
cats gunicorn.service
cat gunicorn.service
mv gunicorn.service gunicorn.service.orig
vi gunicorn.service
systemctl daemon-reload
systemctl status gunicorn.service
systemctl stop gunicorn.service
systemctl status gunicorn.service
ps ax|grep gun
systemctl start gunicorn.service
ps ax|grep gun
killall gunicorn
ps ax|grep gun
kill 5335 5545 5546
ps ax|grep gun
kill -9 5335 5545 5546
ps ax|grep gun
systemctl start gunicorn.service
ps ax|grep gun
systemctl status gunicorn.service
systemctl stop gunicorn.service
systemctl status gunicorn.service
ls
ls gun
ls gun*
systemctl status gunicorn.service
ps ax|grep guni
ps ax|grep gun
systemctl status gunicorn.service
systemctl start gunicorn.service
systemctl status gunicorn.service
systemctl stop gunicorn.service
systemctl status gunicorn.service
ps ax|grep gun
systemctl start gunicorn.service
ps ax|grep gun
systemctl stop gunicorn.service
vi gunicorn.service
systemctl daemon-reload
systemctl start gunicorn.service
systemctl status gunicorn.service
ps axu
netstat -tupna| grep 5001
netstat -tupna| grep 50
netstat -tupna| grep 22
vi gunicorn.service
systemctl daemon-reload
systemctl stop gunicorn.service
systemctl status gunicorn.service
ps aux
systemctl start gunicorn.service
netstat -tupan|grep 500
netstat -tupan|grep 80
ip a
vi gunicorn.service
ps ax|grep uni
systemctl status gunicorn.service
systemctl stop gunicorn.service
systemctl daemon-reload
systemctl stop gunicorn.service
ps ax|grep uni
history grep unic
history | grep unic
/usr/local/bin/gunicorn -b :5001 --workers 4 --threads 100 app:app
ps ax|grep uni
cd /app
/usr/local/bin/gunicorn -b :5001 --workers 4 --threads 100 app:app
vi /etc/systemd/system/gunicorn.service
systemctl daemon-reload
systemctl start gunicorn.service
ps ax|grep gun
netstat -tupna|grep 500
systemctl stop gunicorn.service
/usr/local/bin/gunicorn -b :5001 --workers 4 --threads 100 app:app
ps ax|grep gun
kill -9 26069 26072 26073
ps ax|grep gun
netstat -tupan| grep 500
ps aux|grep gun
mc
less /var/log/syslog
cd /app/
ls
less log/error.log
less log/access.log
vi /etc/systemd/system/gunicorn.servic
systemctl daemon-reload
systemctl start gunicorn.service
systemctl status gunicorn.service
netstat -tupan| grep 500
less /var/log/syslog
less /var/log/apache2/error.log
grep 5001 /etc/apache2/
grep -R 5001 /etc/apache2/
systemctl stop gunicorn.service
ls
ls /etc/systemd/system/gunicorn.service
cat /etc/systemd/system/gunicorn.service
vi /etc/systemd/system/gunicorn.service
systemctl daemon-reload
netstat -tupan| grep 500
systemctl start gunicorn.service
netstat -tupan| grep 500
less /var/log/gunicorn.error.log
ll /run/gunicorn.sock
systemctl stop gunicorn.service
ll /run/gunicorn.sock
rm /run/gunicorn.sock
ll /run/gunicorn.sock
systemctl start gunicorn.service
ll /run/gunicorn.sock
netstat -tupan| grep 500
systemctl stop gunicorn.service
ls -la /etc/systemd/system/gunicorn.socket
rm /etc/systemd/system/gunicorn.socket
systemctl start gunicorn.service
netstat -tupan| grep 500
ll /run/gunicorn.sock
ls -la /etc/systemd/system/gunicorn.socket
systemctl stop gunicorn.service
ls -la /etc/systemd/system/gunicorn.socket
ls
ll /run/gunicorn.sock
ls -la /etc/systemd/system/gunicorn.socket
ls
netstat -tupan| grep 500
ps axu\grep sock
ps axu|grep sock
vi /etc/systemd/system/gunicorn.service
vi /etc/systemd/system/gunicorn.socket
systemd-analyze verify gunicorn.service
systemctl daemon-reload
vi /etc/apache2/sites-available/000-default.conf
cp /etc/systemd/system/gunicorn.socket.orig
mv /etc/systemd/system/gunicorn.socket /etc/systemd/system/gunicorn.socket.orig
vi /etc/systemd/system/gunicorn.service
ps ax|grep uni
systemctl daemon-reload
systemctl start gunicorn
systemctl status gunicorn
ps ax|grep 80000\
ps ax|grep 800
netstat -tupan |grep 800
netstat -tupan |grep 500
systemctl stop gunicorn
vi /etc/systemd/system/gunicorn.service
systemctl daemon-reload
systemctl start gunicorn
systemctl status gunicorn
mc
vi /etc/systemd/system/gunicorn.service
systemctl daemon-reload
systemctl stop gunicorn
systemctl start gunicorn
cat /etc/systemd/system/gunicorn.service
@ShilGen
Copy link
Author

ShilGen commented Jan 29, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment