Skip to content

Commit a882759

Browse files
kaihendrynbiton
authored andcommitted
Instructions for syncing with the development environment (#622)
* Instructions for syncing with the development environment. [skip-ci] unee-t/bugzilla-customisation@25329c2 * Add file back to give better idea of what is required from scratch setup
1 parent 5b71318 commit a882759

File tree

5 files changed

+40
-18
lines changed

5 files changed

+40
-18
lines changed

.env.sample

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ MAIL_URL=<SMPT provider URL>
88
CLOUDINARY_URL=<retrieve by registering for a free account on Cloudinary (should end with /image/upload)>
99
CLOUDINARY_PRESET=<generate in your Cloudinary account (look into 'Unsigned Uploading')>
1010
API_ACCESS_TOKEN=<set any value that will be used to authenticate API requests to this server by the "accessToken" query param>
11-
FROM_EMAIL="LOCAL DEV Unee-T Case <dev.[email protected]>"
11+
FROM_EMAIL="Local Unee-T Case <case.local@unee-t.com>"
1212
STAGE=dev
1313
DOMAIN=<domain origin of the application>

README.md

+6-16
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
They are securely managed in AWS's [parameter store](https://ap-southeast-1.console.aws.amazon.com/ec2/v2/home?region=ap-southeast-1#Parameters:sort=Name). The variables are retrieved via [an environment setup script](https://github.com/unee-t/frontend/blob/master/aws-env.dev), which is utilised by `deploy.sh`.
99

10-
For local development, copy `.env.sample` to `.env`. The values of the environment variables can be obtained from other developers via [Unee-T Slack](https://unee-t.slack.com/messages/C6UM93HD2).
10+
For local development, use `./env-setup.bash` assuming you have been access to the `uneet-dev` development environment.
1111

1212
# Deployment
1313

@@ -78,20 +78,10 @@ Run in browser's developer console:
7878

7979
## How do I set up for local development?
8080

81-
Assuming `.env` is already setup, you need to populate yours users db, by cross
82-
referencing an existing user in the Bugzilla backend. For example running in
83-
the dev tools of your browser:
84-
85-
Accounts.createUser({ email: '[email protected]', password: 'leonel', profile: { bzLogin: '[email protected]', bzPass: 'leonel' }})
86-
87-
Ensure it worked by looking at the `npm start` log.
88-
89-
Note: `[email protected]` is setup inside
90-
https://github.com/unee-t/bugzilla-customisation/tree/master/sql & loaded via [bugzilla-customisation](https://github.com/unee-t/bugzilla-customisation/)'s `make up`.
91-
92-
Next in `meteor mongo`, you can verify the address (without going to mailinator to answer the mail) like so:
93-
94-
db.users.update({'emails.address': '[email protected]'}, {$set : {'emails.0.verified': true}})
81+
1. Make a backup snapshot of the devlopment Mongo database using `backup/dump.sh`
82+
2. `meteor reset` to clear state
83+
3. `npm run start` to start the mongo service
84+
3. `mongorestore -h 127.0.0.1 --port 3001 -d meteor $(date "+dev-%Y%m%d")/meteor`
9585

9686
## How to test the notifications / email templates?
9787

@@ -108,4 +98,4 @@ to the bugzillaCreds **id** from `db.users.find().pretty()`
10898

10999
## error: Error: url must be absolute and start with http:// or https://
110100

111-
Your `.env` file is almost not set up correctly.
101+
Your `.env` file is not set up correctly, consider `./env-setup.bash`

backup/dump.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
for STAGE in prod
2+
for STAGE in dev
33
do
44
echo Mongo dumping stage $STAGE
55
source ../aws-env.$STAGE

backup/local/Makefile

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
dump:
2+
mongodump -h 127.0.0.1 --port 3001 -d meteor
3+
4+
restore:
5+
mongorestore -h 127.0.0.1 --port 3001 -d meteor dump/meteor

env-setup.bash

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/bash
2+
3+
if test -f .env
4+
then
5+
echo .env already exists. Stopping.
6+
exit
7+
fi
8+
9+
ssm() {
10+
echo $(aws --profile uneet-dev ssm get-parameters --names $1 --with-decryption --query Parameters[0].Value --output text)
11+
}
12+
13+
cat << EOF > .env
14+
BUGZILLA_ADMIN_KEY=$(ssm BUGZILLA_ADMIN_KEY)
15+
MAIL_URL=smtps://$(ssm SES_SMTP_USERNAME):$(ssm SES_SMTP_PASSWORD)@email-smtp.us-west-2.amazonaws.com:465
16+
CLOUDINARY_URL=https://api.cloudinary.com/v1_1/unee-t-staging/image/upload
17+
CLOUDINARY_PRESET=$(ssm CLOUDINARY_PRESET)
18+
API_ACCESS_TOKEN=$(ssm API_ACCESS_TOKEN)
19+
FROM_EMAIL="Local Unee-T Case <[email protected]>"
20+
APIENROLL_LAMBDA_URL=http://localhost:4000
21+
INVITE_LAMBDA_URL=http://localhost:9000
22+
UNIT_CREATE_LAMBDA_URL=http://localhost:4001/create
23+
STAGE=dev
24+
DOMAIN=unee-t.com
25+
PDFGEN_LAMBDA_URL=https://pdfgen.dev.unee-t.com
26+
PDFCONVERT_LAMBDA_URL=https://prince.dev.unee-t.com
27+
EOF

0 commit comments

Comments
 (0)