-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathinstall.sh
More file actions
65 lines (47 loc) · 2.6 KB
/
install.sh
File metadata and controls
65 lines (47 loc) · 2.6 KB
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
#!/bin/bash
#https://askubuntu.com/questions/865554/how-do-i-install-python-3-6-using-apt-get/865569#865569
#sudo add-apt-repository -y ppa:deadsnakes/ppa
apt-get update
sudo apt-get update
#http://stackoverflow.com/questions/18696078/postgresql-error-when-trying-to-create-an-extension
#https://www.qgis.org/en/site/forusers/alldownloads.html#debian-ubuntu
##?? https://stackoverflow.com/questions/16527806/cannot-create-extension-without-superuser-role
##?? https://stackoverflow.com/questions/18696078/postgresql-error-when-trying-to-create-an-extension
apt-get install -y postgresql-10 \
postgresql-10-postgis-2.4 \
postgresql-server-dev-all \
pgadmin3 \
python3.6 \
python3-pip \
python3-psycopg2
#we are using vagrant user to deal with postgres because we have the advantage
#of using X11 forwarding for pgAdmin and QGIS
#X11 su user problem
#http://unix.stackexchange.com/questions/110558/su-with-error-x11-connection-rejected-because-of-wrong-authentication
#use postgres user to 1)create postgresql vagrant user 2)grant superuser/createdb roles
su - postgres -c "psql -c \"create user vagrant with superuser createdb;\""
su - vagrant -c 'createdb -E UTF8 katika'
su - vagrant -c "psql katika -c \"CREATE EXTENSION postgis\""
su - vagrant -c "psql katika -f /vagrant/config_french_unaccent.sql"
cd /tmp
# https://anycluster.readthedocs.io/en/latest/installconf.html
git clone https://github.com/umitanuki/kmeans-postgresql.git
cd kmeans-postgresql
make
make install
su - vagrant -c "psql -f /usr/share/postgresql/10/extension/kmeans.sql -d katika"
pip3 install -r /vagrant/requirements.txt
mkdir -p /vagrant/logs/
# https://code.djangoproject.com/ticket/20036
# django.contrib.gis.geos.error.GEOSException: Could not parse version info string "3.4.0dev-CAPI-1.8.0 r0"
# https://unix.stackexchange.com/questions/32907/what-characters-do-i-need-to-escape-when-using-sed-in-a-sh-script
sed -i 's/( r\\d.*/.*$'\''/' /usr/local/lib/python3.6/dist-packages/django/contrib/gis/geos/libgeos.py
#sed -i 's/( r\\d.*/.*$'\''/' $HOME/.local/lib/python3.6/site-packages/django/contrib/gis/geos/libgeos.py
#version_regex = re.compile(
# r'^(?P<version>(?P<major>\d+)\.(?P<minor>\d+)\.(?P<subminor>\d+))'
# r'((rc(?P<release_candidate>\d+))|dev)?-CAPI-(?P<capi_version>\d+\.\d+\.\d+).*$'
#)
#su - vagrant -c "cd /vagrant && python3 manage.py migrate --run-syncdb"
su - vagrant -c "cd /vagrant && python3 manage.py makemigrations tender incident budget jailed transcribe kblog covid19"
su - vagrant -c "python3 /vagrant/populate_db.py"
su - vagrant -c "nohup python3.6 /vagrant/manage.py runserver 0.0.0.0:8000 &"