https://github.com/rajat23/octopus-sharding-postgresql
Sample project to demonstrate the use of Octopus library for database sharding purpose
https://github.com/rajat23/octopus-sharding-postgresql
docker dockercompose jruby octopus postgresql rails5
Last synced: 8 days ago
JSON representation
Sample project to demonstrate the use of Octopus library for database sharding purpose
- Host: GitHub
- URL: https://github.com/rajat23/octopus-sharding-postgresql
- Owner: rajat23
- Created: 2020-02-24T13:23:39.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-03-09T14:24:12.000Z (over 2 years ago)
- Last Synced: 2025-02-14T07:36:32.423Z (5 months ago)
- Topics: docker, dockercompose, jruby, octopus, postgresql, rails5
- Language: Ruby
- Homepage:
- Size: 41 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# README
#### How to Run
1. go to root directory of project
2. run `docker-compose up --build` to build whole system
3. go to another window and connect to db using `docker exec -it bash` ( `docker container ls` to see id)
* create both databases specified in `config/shards.yml`
* run the migration using rake task from web container as specified in step 4
* create table `ar_internal_metadata` for `transport_dev_new` db. refer to same table from `transport_dev` db
```
CREATE TABLE ar_internal_metadata (
key character varying NOT NULL,
value character varying,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
);
ALTER TABLE ONLY ar_internal_metadata
ADD CONSTRAINT ar_internal_metadata_pkey PRIMARY KEY (key);
INSERT INTO ar_internal_metadata(key, value, created_at, updated_at) values('environment', 'development', NOW(), NOW());
```
* clean all rows from `schema_migration_table` from `transport_dev_new` db
* Re run he migration using rake task specified in step 4
4. go to another window and connect to rails app using `docker exec -it bash` ( `docker container ls` to see id)
* run `rake db:migrate`
* run `rake octopus:copy_schema_versions`
#### Problems yet to tackle
1. Creating databases automatically with `rake db:setup`
2. Running Schema migration for only one shard initially and then for another shard