This repository has been archived by the owner on Aug 28, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
installation.txt
93 lines (72 loc) · 2.95 KB
/
installation.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
install postgres 8.4 and contrib modules
sudo yum install postgresql postgresql-server postgresql-contrib
install postgis 1.5
sudo yum install postgis
install postgres php plugin (and restart apache)
sudo yum install php-pgsql
sudo service apache2 restart
sudo find / -iname postgis.sql
on centos: /usr/share/pgsql/contrib/postgis.sql
on debian: /usr/share/postgresql/8.4/contrib/postgis-1.5/postgis.sql
cd /usr/share/pgsql/contrib
sudo -u postgres createdb edgar
sudo -u postgres createlang plpgsql edgar
sudo -u postgres psql -d edgar -f postgis.sql
sudo -u postgres psql -d edgar -f spatial_ref_sys.sql
sudo -u postgres psql -d edgar -f pg_trgm.sql
cd ~/Edgar
sudo -u postgres psql edgar < database_structure.sql
sudo -u postgres psql
create user edgar_frontend with password 'frontend_password'
create user edgar_backend with password 'backend_password'
sudo find / -iname pg_hba.conf
on centos: /var/lib/pgsql/data/pg_hba.conf
on debian: /etc/postgresql/8.4/main/pg_hba.conf
sudo vim /var/lib/pgsql/data/pg_hba.conf
local edgar edgar_frontend md5
local edgar edgar_backend md5
host edgar edgar_frontend 127.0.0.1/32 md5
host edgar edgar_backend 127.0.0.1/32 md5
restart postgres:
centos: sudo service postgresql restart
debian: sudo /etc/init.d/postgresql restart
cd ~/Edgar/importing
python2.6 bootstrap.py
bin/buildout
cp config.example.json config.json
vim config.json
"db.url": "postgresql+psycopg2://edgar_backend:backend_password@/edgar"
sudo -u postgres psql edgar
INSERT INTO sources(name) VALUES('ALA');
vim ~/Edgar/webapplication/app/Config/database.php
public $default = array(
'datasource' => 'Database/Postgres',
'persistent' => false,
'host' => '127.0.0.1',
'port' => 5432,
'login' => 'edgar_frontend',
'password' => 'frontend_password',
'database' => 'edgar',
'prefix' => '',
'encoding' => 'utf8'
);
==================
Setting Up Backups
==================
The command to dump the vettings, users, and species table to a
compressed sql file is:
pg_dump -t users -t species -t vettings edgar | bzip2 > "$(date "+edgar-backup_%F_%H:%M:%S.sql.bz2")"
This assumes the database is named "edgar". The above command will
create a file in the current directory named with the current date and
time, such as:
edgar-backup_2012-08-09_16:53:18.sql.bz2
This should be run as the `postgres` user to have full access to the
database.
To run this every night at midnight as the `postgres` user, edit the
crontab of the `postgres` user with:
sudo -u postgres crontab -e
Then paste this into the file:
# min hr dom mth dow cmd
00 00 * * * cd /where/you/want/the/backups; pg_dump -t users -t species -t vettings edgar | bzip2 > "$(date "+edgar-backup_%F_%H:%M:%S.sql.bz2")"
Change "/where/you/want/the/backups" to an appropriate directory, and
close the crontab file.