Skip to content

Instantly share code, notes, and snippets.

@notjrbauer
Last active August 29, 2015 14:26
Show Gist options
  • Save notjrbauer/611e8fba07a1b2603f25 to your computer and use it in GitHub Desktop.
Save notjrbauer/611e8fba07a1b2603f25 to your computer and use it in GitHub Desktop.

Revisions

  1. notjrbauer revised this gist Aug 10, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion pewpew.md
    Original file line number Diff line number Diff line change
    @@ -91,7 +91,7 @@ The easiest / most sane way of replicating a db is through cloning.

    1. Must first have a `destination` and a `source`.
    2. start `mongo` in your `destination`
    3. enter `db.copyDatabase('the source db name', 'the destination db name', 'ip of source': 'port of source', 'password', 'MONGODB-CR')
    3. enter ```db.copyDatabase('the source db name', 'the destination db name', 'ip of source': 'port of source', 'password', 'MONGODB-CR')```

    ***Example***
    This copies `db` from `127.0.0.1:63488` and places it locally under the `testing` name
  2. notjrbauer revised this gist Aug 10, 2015. 1 changed file with 14 additions and 1 deletion.
    15 changes: 14 additions & 1 deletion pewpew.md
    Original file line number Diff line number Diff line change
    @@ -86,7 +86,20 @@ For any other migration questions, refer to [mongo-migrate](https://github.com/a

    #### Importing things locally in case you're afraid of doing it on prod >)

    **EXPORTING JSON FILES**
    **Cloning DB's**
    The easiest / most sane way of replicating a db is through cloning.

    1. Must first have a `destination` and a `source`.
    2. start `mongo` in your `destination`
    3. enter `db.copyDatabase('the source db name', 'the destination db name', 'ip of source': 'port of source', 'password', 'MONGODB-CR')

    ***Example***
    This copies `db` from `127.0.0.1:63488` and places it locally under the `testing` name

    ```db.copyDatabase('db', 'testing', '127.0.0.1:63448', 'aptible', 'passwords are fun when you share with everyone', 'MONGODB-CR')```


    **EXPORTING JSON FILES** (When the above doesn't work)
    Have your aptible tunnel running...

    Export the doctors table by:
  3. notjrbauer revised this gist Jul 31, 2015. 1 changed file with 4 additions and 10 deletions.
    14 changes: 4 additions & 10 deletions pewpew.md
    Original file line number Diff line number Diff line change
    @@ -33,7 +33,7 @@ For md-admin, you should just be able to run the aforementioned.
    Any code pushed to master will end up on the QA URL's! Please QA before pushing to RC, and communicate with everyone in slack before and after producing an RC.

    #### Backends
    In order to deploy the md-server / md-socket-server to `RC`, one must simple push to the aptible-rc remote.
    In order to deploy the md-server / md-socket-server to `RC`, one must simply push to the aptible-rc remote.

    To find the remotes
    1. go into the aptible dashboard -> coast-to-coast-qa -> and find md-server-rc / md-socket-server-rc
    @@ -86,26 +86,20 @@ For any other migration questions, refer to [mongo-migrate](https://github.com/a

    #### Importing things locally in case you're afraid of doing it on prod >)

    **EXPORTING JSON FILES**
    **EXPORTING JSON FILES**
    Have your aptible tunnel running...

    Export the doctors table by:
    ```mongoexport --host 127.0.0.1:APTIBLEPORT --username aptible --password 'SOMEPASSWORD --authenticationDatabase db --collection doctors --db db --out doctors.json```

    **IMPORT JSON FILES**
    **IMPORT JSON FILES**
    Have mongodb running locally, **make sure you arent connected to aptible**

    Import a doctor table
    Import a doctor table

    ```mongoimport --host 127.0.0.1:LOCALPORT --db db --collection doctors --type json
    doctors.json```
    You can also run the above on any non-local db by specifiying a host, port, username, and password.
    ***All table names must be pluralized***
  4. notjrbauer revised this gist Jul 31, 2015. 1 changed file with 22 additions and 0 deletions.
    22 changes: 22 additions & 0 deletions pewpew.md
    Original file line number Diff line number Diff line change
    @@ -84,6 +84,28 @@ For down: ```node ./\node_modules/\mongodb-migrate -runmm down```

    For any other migration questions, refer to [mongo-migrate](https://github.com/afloyd/mongo-migrate)

    #### Importing things locally in case you're afraid of doing it on prod >)

    **EXPORTING JSON FILES**
    Have your aptible tunnel running...

    Export the doctors table by:
    ```mongoexport --host 127.0.0.1:APTIBLEPORT --username aptible --password 'SOMEPASSWORD --authenticationDatabase db --collection doctors --db db --out doctors.json```

    **IMPORT JSON FILES**
    Have mongodb running locally, **make sure you arent connected to aptible**

    Import a doctor table

    ```mongoimport --host 127.0.0.1:LOCALPORT --db db --collection doctors --type json
    doctors.json```
    You can also run the above on any non-local db by specifiying a host, port, username, and password.
    ***All table names must be pluralized***
  5. notjrbauer revised this gist Jul 31, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion pewpew.md
    Original file line number Diff line number Diff line change
    @@ -82,7 +82,7 @@ your config should look like:
    For up: ```node ./\node_modules/\mongodb-migrate -runmm up``` (or npm run migrate)
    For down: ```node ./\node_modules/\mongodb-migrate -runmm down```

    For any other migration questions, refer to (mongo-migrate)[https://github.com/afloyd/mongo-migrate]
    For any other migration questions, refer to [mongo-migrate](https://github.com/afloyd/mongo-migrate)



  6. notjrbauer revised this gist Jul 31, 2015. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions pewpew.md
    Original file line number Diff line number Diff line change
    @@ -82,6 +82,7 @@ your config should look like:
    For up: ```node ./\node_modules/\mongodb-migrate -runmm up``` (or npm run migrate)
    For down: ```node ./\node_modules/\mongodb-migrate -runmm down```

    For any other migration questions, refer to (mongo-migrate)[https://github.com/afloyd/mongo-migrate]



  7. notjrbauer revised this gist Jul 31, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion pewpew.md
    Original file line number Diff line number Diff line change
    @@ -44,7 +44,7 @@ QA Deployment is automagically done through circle. Just push to the master bran


    ## Migrations mon
    Inside of (md-server)[https://github.com/eaze/md-server/tree/master/migrations] you'll find a migrations folder.
    Inside of [md-server](https://github.com/eaze/md-server/tree/master/migrations) you'll find a migrations folder.

    #### Creating Migrations

  8. notjrbauer revised this gist Jul 31, 2015. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions pewpew.md
    Original file line number Diff line number Diff line change
    @@ -36,9 +36,9 @@ Any code pushed to master will end up on the QA URL's! Please QA before pushing
    In order to deploy the md-server / md-socket-server to `RC`, one must simple push to the aptible-rc remote.

    To find the remotes
    1) go into the aptible dashboard -> coast-to-coast-qa -> and find md-server-rc / md-socket-server-rc
    2) add remote by: ```git remote add aptibleRC [email protected]:somethingfromthedashboard.git```
    3) ```git push aptibleRC master --force```
    1. go into the aptible dashboard -> coast-to-coast-qa -> and find md-server-rc / md-socket-server-rc
    2. add remote by: ```git remote add aptibleRC [email protected]:somethingfromthedashboard.git```
    3. ```git push aptibleRC master --force```

    QA Deployment is automagically done through circle. Just push to the master branch, and if you have some nice tests - you get a nice QA.

  9. notjrbauer revised this gist Jul 31, 2015. 1 changed file with 22 additions and 21 deletions.
    43 changes: 22 additions & 21 deletions pewpew.md
    Original file line number Diff line number Diff line change
    @@ -22,50 +22,51 @@
    ### Deploying

    #### Clients
    When deploying any of the clients to RC, please review the `deploy.sh` file to get a better understanding as to what specific ENV_VARS are needed. See andrew if you have any questions.
    When deploying any of the clients to RC, please review the `deploy.sh` file to get a better understanding as to what specific ```ENV_VARS``` are needed.
    See andrew if you have any questions.

    Run ```EAZE_GIT_PASSWORD=yourpwhereplease NODE_ENV=RC ./deploy.sh```
    Run ```EAZE_GIT_PASSWORD=yourpwhereplease NODE_ENV=RC ./deploy.sh```

    For md-client, you must specific doctor / patient through the ENV_VAR 'APP' (APP=doctor).
    For md-admin, you should just be able to run the aforementioned.

    Any code pushed to master will end up on the QA URL's! Please QA before pushing to RC, and communicate with everyone in slack before and after producing an RC.
    For md-client, you must specific doctor / patient through the ENV_VAR 'APP' (APP=doctor).
    For md-admin, you should just be able to run the aforementioned.

    Any code pushed to master will end up on the QA URL's! Please QA before pushing to RC, and communicate with everyone in slack before and after producing an RC.

    #### Backends
    In order to deploy the md-server / md-socket-server to `RC`, one must simple push to the aptible-rc remote.
    In order to deploy the md-server / md-socket-server to `RC`, one must simple push to the aptible-rc remote.

    To find the remotes
    1) go into the aptible dashboard -> coast-to-coast-qa -> and find md-server-rc / md-socket-server-rc
    2) add remote by: ```git remote add aptibleRC [email protected]:somethingfromthedashboard.git```
    3) ```git push aptibleRC master --force```
    To find the remotes
    1) go into the aptible dashboard -> coast-to-coast-qa -> and find md-server-rc / md-socket-server-rc
    2) add remote by: ```git remote add aptibleRC [email protected]:somethingfromthedashboard.git```
    3) ```git push aptibleRC master --force```

    QA Deployment is automagically done through circle. Just push to the master branch, and if you have some nice tests - you get a nice QA.
    QA Deployment is automagically done through circle. Just push to the master branch, and if you have some nice tests - you get a nice QA.


    ## Migrations mon
    Inside of (md-server)[https://github.com/eaze/md-server/tree/master/migrations] you'll find a migrations folder.

    #### Creating Migrations

    Just run ```node ./node_modules/.bin/mongo-migrate -runmm create patients-add-email``` to create the patients-add-email migration.
    Just run ```node ./node_modules/.bin/mongo-migrate -runmm create patients-add-email``` to create the patients-add-email migration.

    Please keep the naming schema to ```model-action-property```
    Please keep the naming schema to ```model-action-property```

    #### Definging Migrations

    ```Up``` refers to the introduction of something new to the schema, or a change. Please try to make a file per change per property!
    ```Up``` refers to the introduction of something new to the schema, or a change. Please try to make a file per change per property!

    ```Down``` refers to a revert (you make janky migration, define down to go back to the previous state). Define the exact opposite of what ```up``` tries to accomplish.
    ```Down``` refers to a revert (you make janky migration, define down to go back to the previous state). Define the exact opposite of what ```up``` tries to accomplish.

    #### Running Migrations

    **Important**
    There's a [default-config.json](https://github.com/eaze/md-server/blob/master/default-config.json) that specifies the DB which the migrations will act upon.
    Make sure you define it per your db you're operating on. All the information like host, pw, etc can be found on aptible.
    There's a [default-config.json](https://github.com/eaze/md-server/blob/master/default-config.json) that specifies the DB which the migrations will act upon.
    Make sure you define it per your db you're operating on. All the information like host, pw, etc can be found on aptible.

    Example, you tunnel to an aptible db through ```aptible db:tunnel md-mongo-rc``` and it assigned you port 12345
    Example, you tunnel to an aptible db through ```aptible db:tunnel md-mongo-rc``` and it assigned you port ```12345```

    your config should look like:
    your config should look like:
    ```javascript
    {
    mongoAppDb: {
    @@ -78,7 +79,7 @@ your config should look like:
    ```


    For up: ```node ./\node_modules/\mongodb-migrate -runmm up``` (or npm run migrate)
    For up: ```node ./\node_modules/\mongodb-migrate -runmm up``` (or npm run migrate)
    For down: ```node ./\node_modules/\mongodb-migrate -runmm down```


  10. notjrbauer revised this gist Jul 31, 2015. 1 changed file with 71 additions and 0 deletions.
    71 changes: 71 additions & 0 deletions pewpew.md
    Original file line number Diff line number Diff line change
    @@ -3,6 +3,10 @@
    ## Deployment

    ### Urls
    #### DB urls (see aptible dashboard)
    - **QA** : coast-to-coast-qa (will change to match other naming schemes)
    - **RC** : md-mongo-rc

    #### QA
    - [md-socket-server-qa](https://md-socket-server-qa.on-aptible.com)
    - [md-server-qa](https://md-server-qa.on-aptible.com)
    @@ -14,3 +18,70 @@
    - [md-server-rc](https://md-server-rc.on-aptible.com)
    - [md-admin-rc](https://admin-stage.eaze.md)
    - md-client (see andrew)

    ### Deploying

    #### Clients
    When deploying any of the clients to RC, please review the `deploy.sh` file to get a better understanding as to what specific ENV_VARS are needed. See andrew if you have any questions.

    Run ```EAZE_GIT_PASSWORD=yourpwhereplease NODE_ENV=RC ./deploy.sh```

    For md-client, you must specific doctor / patient through the ENV_VAR 'APP' (APP=doctor).
    For md-admin, you should just be able to run the aforementioned.

    Any code pushed to master will end up on the QA URL's! Please QA before pushing to RC, and communicate with everyone in slack before and after producing an RC.

    #### Backends
    In order to deploy the md-server / md-socket-server to `RC`, one must simple push to the aptible-rc remote.

    To find the remotes
    1) go into the aptible dashboard -> coast-to-coast-qa -> and find md-server-rc / md-socket-server-rc
    2) add remote by: ```git remote add aptibleRC [email protected]:somethingfromthedashboard.git```
    3) ```git push aptibleRC master --force```

    QA Deployment is automagically done through circle. Just push to the master branch, and if you have some nice tests - you get a nice QA.


    ## Migrations mon
    Inside of (md-server)[https://github.com/eaze/md-server/tree/master/migrations] you'll find a migrations folder.

    #### Creating Migrations

    Just run ```node ./node_modules/.bin/mongo-migrate -runmm create patients-add-email``` to create the patients-add-email migration.

    Please keep the naming schema to ```model-action-property```

    #### Definging Migrations

    ```Up``` refers to the introduction of something new to the schema, or a change. Please try to make a file per change per property!

    ```Down``` refers to a revert (you make janky migration, define down to go back to the previous state). Define the exact opposite of what ```up``` tries to accomplish.

    #### Running Migrations

    **Important**
    There's a [default-config.json](https://github.com/eaze/md-server/blob/master/default-config.json) that specifies the DB which the migrations will act upon.
    Make sure you define it per your db you're operating on. All the information like host, pw, etc can be found on aptible.

    Example, you tunnel to an aptible db through ```aptible db:tunnel md-mongo-rc``` and it assigned you port 12345

    your config should look like:
    ```javascript
    {
    mongoAppDb: {
    host: 'localhost',
    port: '12345',
    username: 'whatever is in aptible',
    password: 'whatever is in aptible'
    }
    }
    ```


    For up: ```node ./\node_modules/\mongodb-migrate -runmm up``` (or npm run migrate)
    For down: ```node ./\node_modules/\mongodb-migrate -runmm down```





  11. notjrbauer revised this gist Jul 31, 2015. 1 changed file with 10 additions and 8 deletions.
    18 changes: 10 additions & 8 deletions pewpew.md
    Original file line number Diff line number Diff line change
    @@ -1,14 +1,16 @@
    # Deploying and migrating, etc

    ## Deployment
    ### Urls

    ### Urls
    #### QA
    [md-socket-server-rc](https://md-socket-server-rc.on-aptible.com)
    [md-socket-server-rc](https://md-socket-server-rc.on-aptible.com)
    #### RC / Stage
    - [md-socket-server-qa](https://md-socket-server-qa.on-aptible.com)
    - [md-server-qa](https://md-server-qa.on-aptible.com)
    - md-admin (see andrew)
    - md-client (see andrew)

    [md-socket-server-rc](https://md-socket-server-rc.on-aptible.com)
    [md-server-rc](https://md-server-rc.on-aptible.com)
    [md-client-rc](https://md-server-rc.on-aptible.com)
    [md-admin-rc](https://admin-stage.eaze.md)
    #### RC / Stage
    - [md-socket-server-rc](https://md-socket-server-rc.on-aptible.com)
    - [md-server-rc](https://md-server-rc.on-aptible.com)
    - [md-admin-rc](https://admin-stage.eaze.md)
    - md-client (see andrew)
  12. notjrbauer revised this gist Jul 31, 2015. 1 changed file with 6 additions and 1 deletion.
    7 changes: 6 additions & 1 deletion pewpew.md
    Original file line number Diff line number Diff line change
    @@ -3,7 +3,12 @@
    ## Deployment
    ### Urls

    #### QA
    [md-socket-server-rc](https://md-socket-server-rc.on-aptible.com)
    [md-socket-server-rc](https://md-socket-server-rc.on-aptible.com)
    #### RC / Stage

    [md-socket-server-rc](https://md-socket-server-rc.on-aptible.com)
    [md-server-rc](https://md-server-rc.on-aptible.com)
    [md-client-rc](https://md-server-rc.on-aptible.com)
    [md-client-rc](https://md-server-rc.on-aptible.com)
    [md-admin-rc](https://admin-stage.eaze.md)
  13. notjrbauer created this gist Jul 31, 2015.
    9 changes: 9 additions & 0 deletions pewpew.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    # Deploying and migrating, etc

    ## Deployment
    ### Urls

    #### RC / Stage
    [md-socket-server-rc](https://md-socket-server-rc.on-aptible.com)
    [md-server-rc](https://md-server-rc.on-aptible.com)
    [md-client-rc](https://md-server-rc.on-aptible.com)