Skip to content

Commit a014413

Browse files
Merge branch 'dev' of github.com:mapswipe/python-mapswipe-workers into dev
2 parents ce16d24 + f6d8177 commit a014413

File tree

11 files changed

+176
-5418
lines changed

11 files changed

+176
-5418
lines changed

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,4 +123,12 @@ data/
123123
# don't upload app config for project managers dashboard
124124
app.js
125125

126+
# don't upload nginx conf
127+
nginx.conf
128+
*/nginx.conf
129+
130+
# don't upload firebase conf
131+
.firebaserc
132+
*/.firebaserc
133+
126134
.DS_Store

deploy.sh

Lines changed: 86 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,88 @@
11
git pull
2+
if [[ $? = 0 ]]; then
3+
echo "success"
4+
else
5+
echo "failure: $?"
6+
exit
7+
fi
8+
29
python3 test_config.py
3-
sudo docker-compose build --no-cache
4-
sudo docker-compose up -d --force-recreate
5-
sudo docker logs firebase_deploy
6-
sudo docker ps -a
10+
if [[ $? = 0 ]]; then
11+
echo "success"
12+
else
13+
echo "failure: $?"
14+
exit
15+
fi
16+
17+
docker-compose build --no-cache postgres
18+
if [[ $? = 0 ]]; then
19+
echo "success"
20+
else
21+
echo "failure: $?"
22+
exit
23+
fi
24+
25+
docker-compose build --no-cache firebase_deploy
26+
if [[ $? = 0 ]]; then
27+
echo "success"
28+
else
29+
echo "failure: $?"
30+
exit
31+
fi
32+
33+
docker-compose build --no-cache mapswipe_workers
34+
if [[ $? = 0 ]]; then
35+
echo "success"
36+
else
37+
echo "failure: $?"
38+
exit
39+
fi
40+
41+
docker-compose build --no-cache manager_dashboard
42+
if [[ $? = 0 ]]; then
43+
echo "success"
44+
else
45+
echo "failure: $?"
46+
exit
47+
fi
48+
49+
docker-compose build --no-cache nginx
50+
if [[ $? = 0 ]]; then
51+
echo "success"
52+
else
53+
echo "failure: $?"
54+
exit
55+
fi
56+
57+
docker-compose build --no-cache api
58+
if [[ $? = 0 ]]; then
59+
echo "success"
60+
else
61+
echo "failure: $?"
62+
exit
63+
fi
64+
65+
docker-compose up -d --force-recreate postgres firebase_deploy mapswipe_workers manager_dashboard nginx api
66+
if [[ $? = 0 ]]; then
67+
echo "success"
68+
else
69+
echo "failure: $?"
70+
exit
71+
fi
72+
73+
docker logs firebase_deploy
74+
if [[ $? = 0 ]]; then
75+
echo "success"
76+
else
77+
echo "failure: $?"
78+
exit
79+
fi
80+
81+
docker ps -a
82+
if [[ $? = 0 ]]; then
83+
echo "success"
84+
else
85+
echo "failure: $?"
86+
exit
87+
fi
88+

docs/source/configuration.md

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,7 @@ Firebase is a central part of MapSwipe. In our setup we use *Firebase Database*,
3333
1. `your_project_id`: This is the name of your Firebase project (e.g. *dev-mapswipe*)
3434
2. `your_database_name`: This is the name of your Firebase database. It is very likely that this will be the same as your Firebase project name as well.)
3535

36-
The `mapswipe_workers` module uses the [Firebase Python SDK](https://firebase.google.com/docs/reference/admin/python) to access *Firebase Database* services as administrator, you must generate a Firebase Service Account Key in JSON format. You can get it from Firebase.
37-
1. In the Firebase console, open Settings > Service Accounts.
38-
2. Click Generate New Private Key
39-
3. Store the JSON file under `mapswipe_workers/config/serviceAccountKey.json`
36+
The `mapswipe_workers` module uses the [Firebase Python SDK](https://firebase.google.com/docs/reference/admin/python) to access *Firebase Database* services as administrator, you must generate a Service Account Key file in JSON format. For this we use the previously generated Service Account Key. (Check the *Google APIs and Services Credentials* section again if you don't have it.) Copy the file to `mapswipe_workers/config/serviceAccountKey.json`.
4037

4138
The `mapswipe_workers` module further uses the [Firebase Database REST API](https://firebase.google.com/docs/reference/rest/database) to access *Firebase Database* either as a normal user or project manager.
4239

@@ -98,10 +95,7 @@ First, create a new cloud storage bucket:
9895
3. Select storage location > `Multi-Region` > `eu`
9996
4. Select storage class > `Coldline`
10097

101-
Then, generate a Google Cloud Service Account Key:
102-
1. Google Cloud Platform > IAM & Management > Service Accounts
103-
2. Create new Service Account > Select Name > e.g. `your_project_id_postgres_backup`
104-
3. Select Role > `Storage-Administrator`
98+
We need to access Google Cloud Storage. For this we use the previously generated Service Account Key. (Check the *Google APIs and Services Credentials* section again if you don't have it.) Copy the file to `postges/serviceAccountKey.json`.
10599

106100
```bash
107101
GCS_Link_URL=https://console.cloud.google.com/storage/browser/your_project_id_postgres_backup

docs/source/for_mapswipe_managers.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,13 @@ Once you submit, the task should appear relatively quickly in the manager dashbo
3232
* If you encounter any error like *the % is not rising anymore in the app*, *the number of mappers is not rising anymore in the app* *firebase functions* might be the reason for this. Check firebase functions logs (Firebase > Functions > Logs) or reach out for help in Slack.
3333

3434

35+
## Becoming a project manager
3536

37+
If you have access to the mapswipe backend server you can grant project manager rights like this:
38+
39+
```bash
40+
docker run --name mapswipe_workers_local -it pythonmapswipeworkers_mapswipe_workers bash`
41+
mapswipe_workers --verbose user-management [email protected] --manager=true
42+
exit
43+
docker rm mapswipe_workers_local
3644

0 commit comments

Comments
 (0)