View difference between Paste ID: Pdqh2Ji9 and zFfLuMV6
SHOW: | | - or go back to the newest paste.
1-
Title: Throat Install Guide, base Alpine Linux 3.10 multi-db
1+
Title: Throat Install Guide, base Alpine Linux 3.10 MariaDB
2
3
###
4
### Assume basic installation of Alpine Linux, openssh server installed and setup, a non-root user created and added to /etc/sudoers, bash installed
5
###
6
7
## Switch to root and  install dependencies
8
sudo su -
9
apk add --no-cache git bash build-base libffi-dev openssl-dev bzip2-dev zlib-dev readline-dev sqlite-dev curl bash bash-doc bash-completion redis npm jpeg-dev exiv2-dev boost-dev libxml2-dev libxslt-dev freetype-dev
10
11
## This is needed for the pip stage later on
12
ln -s /usr/lib/libboost_python37.so /usr/lib/libboost_python3.so
13
14
## Create user under which throat is installed and switch to it.
15
adduser --disabled-password --gecos "" -s /bin/bash app
16
su - app
17
18
## Setup pyenv
19
curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash
20
echo 'export PATH="/home/app/.pyenv/bin:$PATH"' >> ~/.profile
21
echo 'eval "$(pyenv init -)"' >> ~/.profile
22
echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.profile
23
exit
24
25-
### Database-related setup, pick your poison
25+
## Database setup
26
apk add --no-cache mariadb mariadb-client mariadb-connector-c-dev
27
mysql_install_db --user=mysql --datadir=/var/lib/mysql
28-
## [M] For MySQL/MariaDB:
28+
29
mysqladmin -u root password "Pass1234"
30
rc-update add mariadb default
31
mysql -u root -p
32
CREATE DATABASE throat;
33
CREATE USER 'throat'@localhost IDENTIFIED BY 'Pass1234';
34
GRANT ALL PRIVILEGES ON throat.* TO 'throat'@localhost;
35
exit
36
37
## Start redis and add to startup
38
rc-service redis start
39
rc-update add redis default
40-
## [M] end
40+
41
## Switch back to app and install python and set virtualenv
42
su - app
43-
## [P] For Postgresql:
43+
44
pyenv virtualenv 3.6.8 app
45-
apk add --no-cache postgresql postgresql-client postgresql-dev
45+
46-
sudo su - postgres
46+
47-
psql
47+
48
cd throat
49-
CREATE USER throat PASSWORD 'Pass1234';
49+
50-
GRANT ALL PRIVILEGES ON DATABASE throat TO throat;
50+
51
pyenv local app
52-
## [P] end
52+
53
## Upgrade pip, get requirements
54
pip install --upgrade pip
55-
## [S] For SQLite:
55+
56
57
## Create and modify config
58-
apk add --no-cache sqlite
58+
59
nano config.py
60-
## [S] end
60+
61
##
62
## Database connection configuration
63
##
64
65
DATABASE = {
66
    'host': 'localhost',
67
    'name': 'throat',
68
    'engine': 'MySQLDatabase',
69
    'user': 'throat',
70
    'password': 'Pass1234',
71
}
72
73
## Setup database
74
scripts/migrate.py
75
76
## to be able to access it from outside localhost...
77
nano wsgi.py
78
#add ", host='0.0.0.0'" to "socketio.run(app, debug=True)" inside parentheses
79
 
80
## to run: ./wsgi.py
81
## find IP of your machine (ifconfig), visit: http://<ip address>:5000
82
83-
## [S] For SQLite:
83+
84
scripts/admins.py --add admin
85-
sqlite3 throat.db
85+
86-
.quit
86+
87-
## [S] end
87+