This repository has been archived by the owner on Apr 9, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvagga.yaml
193 lines (192 loc) · 6.48 KB
/
vagga.yaml
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
183
184
185
186
187
188
189
190
191
192
193
containers:
ansible:
setup:
- !Alpine v3.3
- !Py2Install [ansible, ecdsa, Jinja2, MarkupSafe, paramiko==1.17.0, pycrypto, PyYAML]
- !PipConfig
dependencies: true
environ:
ANSIBLE_HOST_KEY_CHECKING: false
app-freezer:
setup:
- !Alpine v3.3
- !BuildDeps
- libmemcached-dev
- zlib-dev
- libxslt-dev
- postgresql-dev
- mariadb-dev
- gcc
- !NpmInstall [bower]
- !Py3Install
- setuptools
- pip
- six
- 'Django >=1.9,<1.10'
- 'django-extensions >=1.6.7,<1.7'
- 'django-debug-toolbar >=1.5,<2.0'
- 'django-environ >=0.4,<0.5'
- 'pylibmc >=1.5,<1.6'
- 'django-cache-url >=1.0,<1.1'
- 'psycopg2 >=2.6,<2.7'
- 'django-bootstrap3 >=7.0.1,<7.1'
- 'redis >=2.10.5,<2.11'
- 'rq >=0.6,<0.7'
- 'rq-scheduler >=0.6.1,<0.7'
- 'django-rq >=0.9.1,<1.0'
- 'arrow >=0.7.0,<0.8'
- 'python-dateutil >=2.5.3,<2.6'
- 'django-rq-jobs >=0.1.5.1,<0.1.6'
- 'mysqlclient >=1.3.7,<1.4'
- 'gunicorn >=19.6.0,<19.7'
- 'django-datetime-widget >=0.9.3,<1.0'
- 'django-recurrence >=1.3.0,<1.4'
- 'django-smart-selects >=1.2.2,<1.3'
- 'django-npm >=1.0.0,<1.1'
- 'django-bower >=5.1.0,<5.2'
- 'django-rosetta >=0.7.11,<0.8'
- 'ipython >=5.0.0,<5.1'
- 'ipdb >=0.10.0,<1.0'
- 'Werkzeug >=0.11.4,<0.12'
- 'watchdog >=0.8.3,<0.9'
- 'git+https://github.com/wk-tech/[email protected]#egg=smsfly'
- !Sh pip uninstall --yes SMSFly
- !Sh pip freeze > requirements.txt
- !Sh echo '-e git+https://github.com/wk-tech/[email protected]#egg=smsfly' >> requirements.txt
# - !Sh pip install -r requirements.txt
# - !Sh python3 manage.py bower --pythonpath=/work freeze
django:
setup:
- !Alpine v3.3
- !Install
- libmemcached
- libmemcached-dev # needed to build pylibmc python package
- zlib
- libxslt-dev
- libsasl
- libpq
- mariadb-client
- mariadb-dev
- postgresql-dev # needed to build psycopg2 python package
- nodejs
- sqlite
- git
- gcc
- gettext
- !EnsureDir /root/.npm
- !EnsureDir /work/.npm
- !PipConfig
dependencies: true
- !Py3Requirements requirements.txt
- !NpmInstall [bower]
environ:
HOME: /work
DATABASE_URL: sqlite:///db.sqlite3
volumes:
/root/.npm: !BindRW /work/.npm
redis:
setup:
- !Alpine v3.3
- !Install
- redis
memcached:
setup:
- !Alpine v3.3
- !Install [memcached]
postgres:
setup:
- !Ubuntu trusty
- !Install [postgresql]
- !EnsureDir /data
# uncomment the line below to make postgres data persistent
# - !EnsureDir /work/.db/data
environ:
PGDATA: /data
PG_PORT: 5433
PG_DB: django
PG_USER: vagga
PG_PASSWORD: vagga
PG_BIN: /usr/lib/postgresql/9.3/bin
volumes:
/data: !Tmpfs
size: 100M
mode: 0o700
# replace the volume above with the one below to make postgres data persistent
# /data: !BindRW /work/.db/data
commands:
run: !Command
description: Start the django development server
container: django
run: python3 manage.py runserver
manage.py: !Command
description: Shortcut to manage.py
container: django
run:
- python3
- manage.py
run-cached: !Supervise
description: Start the django development server alongside memcached
children:
cache: !Command
container: memcached
run: memcached -u memcached -vv
app: !Command
container: django
environ:
HOME: /work
CACHE_URL: memcached://127.0.0.1:11211
run: |
python3 manage.py migrate --pythonpath=$HOME
echo "from npm.finders import npm_install; npm_install()" | python3 ./manage.py shell --pythonpath=$HOME
python3 manage.py bower --pythonpath=$HOME install -- --allow-root
python3 manage.py runserver_plus --pythonpath=$HOME --traceback
rq: !Command
container: django
environ:
HOME: /work
run: |
python3 manage.py rqscheduler --pythonpath=$HOME &
while [ true ]; do sleep 60; python3 manage.py rqjobs --pythonpath=$HOME; done &
while [ true ]; do sleep 1800; python3 manage.py sms_campaign_scheduler --pythonpath=$HOME 30; done &
python3 manage.py rqworker --pythonpath=$HOME high default low
redis: !Command
container: redis
run: |
redis-server --daemonize no --bind 127.0.0.1
run-postgres: !Supervise
description: Start the django development server using Postgres database
children:
app: !Command
container: django
environ:
DATABASE_URL: postgresql://vagga:[email protected]:5433/django
run: |
touch /work/.dbcreation # Create lock file
while [ -f /work/.dbcreation ]; do sleep 0.2; done # Acquire lock
python3 manage.py migrate
python3 manage.py runserver
db: !Command
container: postgres
run: |
chown postgres:postgres $PGDATA;
su postgres -c "$PG_BIN/pg_ctl initdb";
su postgres -c "echo 'host all all all trust' >> $PGDATA/pg_hba.conf"
su postgres -c "$PG_BIN/pg_ctl -w -o '-F --port=$PG_PORT -k /tmp' start";
su postgres -c "$PG_BIN/psql -h 127.0.0.1 -p $PG_PORT -c \"CREATE USER $PG_USER WITH PASSWORD '$PG_PASSWORD';\""
su postgres -c "$PG_BIN/createdb -h 127.0.0.1 -p $PG_PORT $PG_DB -O $PG_USER";
rm /work/.dbcreation # Release lock
sleep infinity
# replace the 'run:' above with the one below to make postgres data persistent
# run: |
# chown postgres:postgres $PGDATA;
# if [ -z $(ls -A $PGDATA) ]; then
# su postgres -c "$PG_BIN/pg_ctl initdb";
# su postgres -c "echo 'host all all all trust' >> $PGDATA/pg_hba.conf"
# su postgres -c "$PG_BIN/pg_ctl -w -o '-F --port=$PG_PORT -k /tmp' start";
# su postgres -c "$PG_BIN/psql -h 127.0.0.1 -p $PG_PORT -c \"CREATE USER $PG_USER WITH PASSWORD '$PG_PASSWORD';\""
# su postgres -c "$PG_BIN/createdb -h 127.0.0.1 -p $PG_PORT $PG_DB -O $PG_USER";
# else
# su postgres -c "$PG_BIN/pg_ctl -w -o '-F --port=$PG_PORT -k /tmp' start";
# fi
# rm /work/.dbcreation # Release lock
# sleep infinity