Skip to content

Commit e9737c5

Browse files
author
Kai Hendry
committed
Various tweaks
1 parent ea045a8 commit e9737c5

File tree

6 files changed

+14
-14
lines changed

6 files changed

+14
-14
lines changed

.travis.yml

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ services:
44
- docker
55

66
before_install:
7-
- pyenv global 2.7.14 # For removing SNIMissingWarning warnings
87
- pip install --user awscli
98
- export PATH=$PATH:$HOME/.local/bin
109
- curl -o $HOME/.local/bin/ecs-cli

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ build:
1111
docker build -t uneet/bugzilla-customisation .
1212

1313
down:
14-
docker-compose down
14+
docker-compose down -v
1515

1616
pull:
1717
docker-compose pull

README.md

+3-6
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,8 @@ Requires [docker](https://www.docker.com/) &
1717

1818
# Developing locally
1919

20-
We used to start from a prime sql, but that had a couple of drawbacks:
21-
22-
* The prime sql schema was often out of date or unused/untested
23-
* When starting from scratch, you had to manually create users `Accounts.createUser` to sync the [Frontend](https://github.com/unee-t/frontend)
24-
* The dev environment is more likely to have an existing / interesting bug state to be fixed locally
20+
We used to start from a [prime sql](https://github.com/unee-t/bz-database), but
21+
now we being from existing development snapshots.
2522

2623
The idea now is to start from a **snapshot** of the remote development (dev)
2724
environment. Our remote dev environment is hosted on AWS and so are all the
@@ -44,7 +41,7 @@ Make sure your local .env is correctly setup with `./env-setup.bash`
4441

4542
docker-compose up -d db # Just start the database at first, should be empty
4643
# Restore dev snapshot
47-
mysql -h 127.0.0.1 -P 3306 -u root --password=$MYSQL_ROOT_PASSWORD bugzilla < dev-backup.sql
44+
mysql -h db -P 3306 -u root --password=$MYSQL_ROOT_PASSWORD bugzilla < dev-backup.sql
4845
make up
4946

5047
The dashboard administrator username / password is:

backup/backup.sh

+3-2
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,10 @@ shift "$((OPTIND-1))" # Discard the options and sentinel --
4141

4242
if test $AWS_PROFILE == uneet-localhost
4343
then
44-
echo mongorestore -h 127.0.0.1 --drop --port 27017 $dir
44+
export MYSQL_ROOT_PASSWORD=$(aws --profile uneet-dev ssm get-parameters --names MYSQL_ROOT_PASSWORD --with-decryption --query Parameters[0].Value --output text)
45+
echo mysqldump -B -R -h 127.0.0.1 -P 3306 -u root --password=$MYSQL_ROOT_PASSWORD bugzilla
4546
else
4647
export MYSQL_ROOT_PASSWORD=$(aws --profile $AWS_PROFILE ssm get-parameters --names MYSQL_ROOT_PASSWORD --with-decryption --query Parameters[0].Value --output text)
4748
export MYSQL_HOST=$(aws --profile $AWS_PROFILE ssm get-parameters --names MYSQL_HOST --with-decryption --query Parameters[0].Value --output text)
48-
mysqldump --single-transaction --skip-lock-tables --ignore-table=bugzilla.attach_data --column-statistics=0 -R -h $MYSQL_HOST -P 3306 -u root --password=$MYSQL_ROOT_PASSWORD bugzilla > $STAGE-backup-$(date +%s).sql
49+
mysqldump -B --single-transaction --skip-lock-tables --ignore-table=bugzilla.attach_data --column-statistics=0 -R -h $MYSQL_HOST -P 3306 -u root --password=$MYSQL_ROOT_PASSWORD bugzilla > $STAGE-backup-$(date +%s).sql
4950
fi

backup/restore.sh

+4-3
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,9 @@ done
4040
AWS_PROFILE=uneet-$STAGE
4141
shift "$((OPTIND-1))" # Discard the options and sentinel --
4242

43-
export PASSWORD=$(aws --profile $AWS_PROFILE ssm get-parameters --names unee_t_root-Password --with-decryption --query Parameters[0].Value --output text)
43+
#export PASSWORD=$(aws --profile $AWS_PROFILE ssm get-parameters --names unee_t_root-Password --with-decryption --query Parameters[0].Value --output text)
44+
export PASSWORD=$(aws --profile $AWS_PROFILE ssm get-parameters --names MYSQL_ROOT_PASSWORD --with-decryption --query Parameters[0].Value --output text)
4445
export MYSQL_HOST=$(aws --profile $AWS_PROFILE ssm get-parameters --names MYSQL_HOST --with-decryption --query Parameters[0].Value --output text)
4546
echo Restoring $1 to $MYSQL_HOST
46-
mysql -h $MYSQL_HOST -P 3306 -u unee_t_root --password=$PASSWORD bugzilla < $1
47-
47+
mysql -h $MYSQL_HOST -P 3306 -u root --password=$PASSWORD bugzilla < $1
48+
#mysql -h $MYSQL_HOST -P 3306 -u unee_t_root --password=$PASSWORD bugzilla < $1

db/connect.sh

+3-1
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,6 @@ echo Connecting to ${STAGE^^} $(domain $STAGE)
4848
MYSQL_PASSWORD=$(aws --profile $AWS_PROFILE ssm get-parameters --names MYSQL_ROOT_PASSWORD --with-decryption --query Parameters[0].Value --output text)
4949
MYSQL_USER=$(aws --profile $AWS_PROFILE ssm get-parameters --names MYSQL_USER --with-decryption --query Parameters[0].Value --output text)
5050

51-
echo mysql -h $(domain $STAGE) -P 3306 -u root --password=$MYSQL_PASSWORD bugzilla
51+
echo $STAGE
52+
echo mysql -s -h $(domain $STAGE) -P 3306 -u root --password=$MYSQL_PASSWORD bugzilla
53+
mysql -s -h $(domain $STAGE) -P 3306 -u root --password=$MYSQL_PASSWORD bugzilla

0 commit comments

Comments
 (0)