-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathconfiguring.txt
160 lines (122 loc) · 4.94 KB
/
configuring.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
########################################
# old centos servers
sudo yum install git
#sudo yum install postgresql-server
#sudo yum install postgresql-contrib
# install py3 (might not be the bast way to do this)
#sudo yum install centos-release-scl
#sudo yum install rh-python36
#scl enable rh-python36 bash
#install pip
sudo yum groupinstall 'Development Tools'
# pip is not on secure_path
sudo /opt/rh/rh-python36/root/usr/bin/pip install --upgrade pip
sudo /opt/rh/rh-python36/root/usr/bin/pip install pipenv
echo 'export PATH="/var/lib/autocat/.local/bin:$PATH"' >> ~/.bashrc
#
########################################
#
# new debian servers
#
# install pyenv and desired python
curl -L https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer | bash
# Load pyenv automatically by appending
# the following to
~/.bash_profile if it exists, otherwise ~/.profile (for login shells)
and ~/.bashrc (for interactive shells) :
export PYENV_ROOT="$HOME/.pyenv"
command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
# Restart your shell for the changes to take effect.
# Load pyenv-virtualenv automatically by adding
# the following to ~/.bashrc:
eval "$(pyenv virtualenv-init -)"
pyenv install 3.9.18
pyenv local 3.9.18
#
########################################
# create autocat user with home directory /var/lib/autocat
sudo useradd -d /var/lib/ autocat
sudo passwd autocat
sudo su - autocat
# create ~/.ssh/id_rsa and ~/.ssh/id_rsa.pub using app key from the gutenbergtools/autocat3 repo
# id_rsa should have permissions 400
mkdir .ssh
install -m 600 .ssh/id_rsa
touch .ssh/id_rsa.pub
#!! from local
# scp [local:].ssh/github [autocat@host:]~/.ssh/id_rsa
# scp [local:].ssh/github.pub [autocat@host:]~/.ssh/id_rsa.pub
# currently id_ecdsa and id_ed25519
chmod 400 .ssh/id_rsa
# create ~/.pgpass file to store password in format
# [pghost]:*:[pgdatabase]:[pguser]:[password]
chmod 400 .pgpass
#set default python - only needed if pu3 is
#scl enable rh-python36 bash
source scl_source enable rh-python39
#echo 'source scl_source enable rh-python39' >> /var/lib/autocat/.bash_profile
git clone [email protected]:gutenbergtools/autocat3.git
cd autocat3
pipenv --three
git checkout remotes/origin/master
# if the install chokes on psycopg2, probably you need to add pg_config to your PATH
# on rhel7 may need to install rh-python38-python-devel, libffi-devel and postgresql-devel
pipenv install
# add local conf file. keep secrets here!
# for production .autocat3 should set values for these parameters:
# pghost, pguser,
# dropbox_client_secret, gdrive_client_secret, msdrive_client_secret,
# log.error_file, log.access_file
#!! from local
# Better to copy conf file from guten2 cause it's up-to-date
# scp [local:]~/autocat3.conf [autocat@host:]~/.autocat3
mkdir /var/lib/autocat/log/
touch /var/lib/autocat/log/error.log
touch /var/lib/autocat/log/access.log
exit
sudo mkdir /var/run/autocat
sudo touch /var/run/autocat/autocat3.pid
# sudo chown autocat /var/run/autocat/autocat3.pid
# Better to set the group name as pgweb for /var/run/autocat
# for local development, just chown to your username in stead of autocat
sudo chown -R autocat:pgweb /var/run/autocat
python CherryPyApp.py
#####
##### To install or update the autocat3 service
#####
sudo systemctl enable /var/lib/autocat/autocat3/autocat3.service
sudo systemctl start autocat3
# If there are problems with `sudo systemctl enable /var/lib/autocat/autocat3/autocat3.service`
# it might be due to monit (the monitoring system) fighting to restart. Or it might be that the
# service is in an uncertain state, not stopped. Try:
sudo service autocat3 stop
sudo systemctl disable autocat3.service
sudo systemctl enable /var/lib/autocat/autocat3/autocat3.service
sudo systemctl restart autocat3.service
sudo systemctl status autocat3.service
# `sudo rm /etc/systemd/system/autocat3.service` is probably not needed. As of July 20 2019,
# we are having problems with monit trying to restart. It might be necessary to also stop
# monit. Further diagnosis is forthcoming.
## Development
create a "feature" branch on on the git repo, using either master or development as base.
when your code is working, submit a pull request to master or development as appropriate.
## updates
# currently gutenberg-app1 is production deployment, gutenberg-appdev1 is dev deployment
# to do a new deployment, first update from master
# DONT edit files on the deployment servers, they should always be updated from the git remote.
su - autocat
# or sudo su - autocat if you can sudo
cd autocat3
git fetch origin
#for local development
git checkout remotes/origin/dev
do NOT develop on the following branches, update them from master.
# for gutenberg-app1
git checkout remotes/origin/prod
# for gutenberg-appdev1
git checkout remotes/origin/appdev
pipenv install --ignore-pipfile
sudo systemctl restart autocat3
## How to test
the file test_post.html is provided for testing advanced search when running on 127.0.0.1:8000