forked from dimagi/commcare-hq
-
Notifications
You must be signed in to change notification settings - Fork 4
/
fabfile.py
92 lines (69 loc) · 2.44 KB
/
fabfile.py
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
# coding: utf-8
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import absolute_import
from six.moves import input
import os
import time
print()
print("Hey things have changed.")
print()
time.sleep(1)
print("We now do deploys from the commcare-cloud directory or the control machine.")
print()
time.sleep(2)
if 'y' == input('Do you want instructions for how to migrate? [y/N]'):
print()
for dir_name in ['commcarehq-ansible', 'commcare-cloud']:
ansible_repo = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', dir_name))
ansible_repo_exists = os.path.isdir(os.path.join(ansible_repo, '.git'))
if ansible_repo_exists:
break
else:
if 'y' != input('Do you have a local commcare-cloud '
'(formerly called commcarehq-ansible) repository already? [y/N]'):
print("""
Set up commcare-cloud
=========================
Put the commcarehq-ansible repo alongside this one like so:
cd ..
git clone https://github.com/dimagi/commcare-cloud.git
cd commcare-cloud
Now make a virtualenv for ansible:
mkvirtualenv ansible
""")
else:
print("""
Link commcare-cloud repo
============================
Symlink your commcare-cloud (or commcarehq-ansible) repo so that it lives alongside this one:
ln -s <path/to/commcare-cloud> {ansible_repo}
When you have done that, run
fab
to see more instructions.
""".format(ansible_repo=ansible_repo))
exit(1)
if ansible_repo_exists:
print("✓ You already have the commcare-cloud repo alonside this one: {}"
.format(ansible_repo))
print()
time.sleep(1)
print("""
Make your ansible environment fab-ready
=======================================
Enter the commcare-cloud repo and make sure you have the latest
cd {ansible_repo}
git pull
enter the env
workon ansible
do the necessary pip installs
pip install -r fab/requirements.txt
and make sure the necessary files are in the right place
./control/check_install.sh
Run a fab command!
==================
fab production deploy
Remember that in steady state, you will need to workon the ansible virtualenv
and enter the commcare-cloud directory before you will be able to run a fab command.
""".format(ansible_repo=ansible_repo))
exit(1)