Skip to content

Commit

Permalink
dockerize
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasdziedzic-pd committed Aug 4, 2016
1 parent ecd4ac8 commit fb64cd8
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ script:
addons:
code_climate:
repo_token: 0b58d4e91bfac6ed6e48b31606f6792598a3a59c27bded19d58ef8406c09f57c
hosts:
- mysql.pagerduty.net
matrix:
fast_finish: true
allow_failures:
Expand Down
8 changes: 8 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM ruby:2.1

RUN apt-get update
RUN apt-get install -y percona-toolkit

COPY . /code/

WORKDIR /code
34 changes: 34 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,37 @@ Support for other versions of these tools is unknown and not guaranteed.
`pt-osc` requires the use of `pt-online-schema-change` 2.0 or later. Some options may not work with all versions.

`pt-osc` is compatible with versions 0.5.0 and later of [zdennis/activerecord-import](https://github.com/zdennis/activerecord-import). It will not work with earlier versions.

## Testing

create a machine for pt-osc, this should only be needed once

```
docker-machine create pt-osc --driver virtualbox
```

every new shell that needs to access pt-osc within docker needs to run:

```
eval $(docker-machine env pt-osc)
```

to access the docker shell

```
docker-compose run pt-osc bash
```

### useful commands in docker shell

create the initial database within mysql for tests, only needed once

```
bundle exec rake db:test_create
```

run the tests in docker

```
bundle exec rake
```
18 changes: 18 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
version: '2'
services:
pt-osc:
build: .
links:
- mysql:mysql.pagerduty.net
volumes:
- .:/code
- ptosc_bundle:/usr/local/bundle
- ./docker/pt-online-schema-change.conf:/etc/percona-toolkit/pt-online-schema-change.conf
environment:
- BUNDLE_PATH=/usr/local/bundle
mysql:
image: mysql:5.5
environment:
- MYSQL_ALLOW_EMPTY_PASSWORD=yes
volumes:
ptosc_bundle: {}
1 change: 1 addition & 0 deletions docker/pt-online-schema-change.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
host=mysql.pagerduty.net
3 changes: 2 additions & 1 deletion test/config/database.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
test: &test
pool: 5
host: localhost
host: mysql.pagerduty.net
port: 3306
username: root
database: pt_osc_test
reconnect: true
Expand Down

0 comments on commit fb64cd8

Please sign in to comment.