-
Notifications
You must be signed in to change notification settings - Fork 0
/
INSTALL.txt
182 lines (155 loc) · 5.27 KB
/
INSTALL.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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
== Dependency ==
1. admin(backtoshops) server:
sudo apt-get install libapache2-mod-wsgi python2.7-dev libpq-dev python-pip git \
libtiff4-dev libjpeg8-dev zlib1g-dev libfreetype6-dev \
liblcms1-dev libwebp-dev gettext libevent-dev swig memcached
2. user server:
sudo apt-get install python2.7-dev libpq-dev python-pip git python-lxml \
libtiff4-dev libjpeg8-dev zlib1g-dev libfreetype6-dev \
liblcms1-dev libwebp-dev libevent-dev swig redis-server \
libxml2-dev libxslt1-dev
3. finance server:
sudo apt-get install python2.7-dev libpq-dev python-pip git python-lxml \
libcairo2 libpango1.0-0 libgdk-pixbuf2.0-0 libffi-dev shared-mime-info \
libxml2-dev libxslt1-dev
4. front server:
sudo apt-get install python2.7-dev python-pip git sendmail sendmail-cf
5. assets server:
sudo apt-get install python2.7-dev python-pip git
== Database ==
1. install postgres 9.1
sudo apt-get install postgresql-9.1 postgresql-contrib
2. Config pg_hba.conf (/etc/postgresql/9.1/main/pg_hba.conf):
host all bts $(your ip)/32 trust
host all postgres $(your ip)/32 trust
host all $(your name) $(your ip)/32 trust
host all all 127.0.0.1/32 trust
host all all 0.0.0.0 0.0.0.0 reject
host all all ::1/128 md5
3. Config postgresql.conf (/etc/postgresql/9.1/main/postgresql.conf)
change listen_addresses to '*'
change ssl = true to ssl = false
change port to 5432
4. Create user
$ sudo su - postgres
$ psql template1
# CREATE USER bts;
# CREATE USER $(your name);
# ALTER USER bts WITH SUPERUSER;
# ALTER USER $(your name) WITH SUPERUSER;
5. Restart database:
$ sudo /etc/init.d/postgresql restart
== Checkout Code ==
$ hg clone https://dragondollar.kilnhg.com/Code/Repositories/Group/Dragon-Dollar
== Virtualenv ==
1. Install:
$ pip install virtualenv
$ pip install virtualenvwrapper
2. Config:
* Add following config into ~/.bashrc
export WORKON_HOME=$HOME/.virtualenvs
* Add following config into ~/.profile
source /usr/local/bin/virtualenvwrapper.sh
3. Add new virtualenv:
$ mkvirtualenv env --no-site-packages
4. Active virtualenv:
$ workon env
== Project Python Library ==
1. Add pip config to install Local python library
$ cd ~/.pip
$ touch pip.conf
Add following config into pip.conf (change the path to your real path, e.g. /home/jessica/svn/backtoshops/packages/dist)
{{{
[global]
find-links =
/$(PROJECT_HOME)/packages/dist
[install]
find-links =
/$(PROJECT_HOME)/packages/dist
}}}
2. install libraries
* admin server
$ workon env
$ cd /$(PROJECT_HOME)
$ pip install -r requirements/adm.backtoshops.com.requirements.txt
* user server
$ workon env
$ cd /$(PROJECT_HOME)
$ pip install -r requirements/usr.backtoshops.com.requirements.txt
* finance server
$ workon env
$ cd /$(PROJECT_HOME)
$ pip install -r requirements/finance.backtoshops.com.requirements.txt
* front server
$ workon env
$ cd /$(PROJECT_HOME)
$ pip install -r requirements/front.requirements.txt
* assets server
$ workon env
$ cd /$(PROJECT_HOME)
$ pip install -r requirements/assets.backtoshops.com.requirements.txt
== Create Project database ==
1. admin server:
* create database
$ createdb -E UNICODE backtoshops
$ cd $(PROJECT_HOME)/backtoshops
$ ./manage.py syncdb
$ ./manage.py migrate
* load test data
$ psql backtoshops -f data/test_data.sql
2. user server:
$ cd $(PROJECT_HOME)/users
$ ./setupdb.sh
3. finance server:
$ cd $(PROJECT_HOME)/finance
$ ./setupdb.sh
== Generate Hmac Key ==
* required for user login
$ workon env
$ cd /$(PROJECT_HOME)/users
$ python ./scripts/gen_hmac_key.py
== Make/Compile PO files ==
$ python i18nmessages.py --locale=fr_FR make
$ python i18nmessages.py --locale=zh_CN make
$ python i18nmessages.py compile
== Start servers ==
1. admin server:
* change following line in $(PROJECT_HOME)/backtoshops/settings.py
from settings_production import *
to
from settings_local import *
* start admin server
$ workon env
$ cd $(PROJECT_HOME)/backtoshops
$ ./manage.py runserver 0.0.0.0:8000
2. user server:
$ workon env
$ cd $(PROJECT_HOME)/users
$ ./start_redis.sh
$ python server.py
3. finance server:
$ workon env
$ cd $(PROJECT_HOME)/finance
$ python fin_server.py
4. assets server
$ workon env
$ cd $(PROJECT_HOME)/assets
$ python assets_server.py
5. front server
$ workon env
$ cd $(PROJECT_HOME)/front
$ python front_server.py
== Admin server (backoffice) access ==
1. url (change $(server-ip) to the ip which start admin server):
http://$(server-ip):8000/
2. Login with test account (loaded by test_data.sql):
Super Admin:
* test_admin_1000000/admin4u
Brand Admin:
* test_user1_1000000/user14u
* test_user2_1000000/user24u
* test_user3_1000000/user34u
* test_user4_1000000/user44u
== Test ==
1. Please follow the following wiki to run user server tests
http://trac.lbga.fr/backtoshops/wiki/BTS/tests