Upgrade DecapodΒΆ

To upgrade Decapod from 0.1.x to 1.0.0:

  1. Back up the database:

    • To use the existing configuration, run the following command from the directory where you run Decapod:

      $ docker exec -i proj_database_1 mongodump --gzip --archive --ssl \
      --sslAllowInvalidCertificates > ~/pre_upgrade
      

      Where proj is the lowercase container name.

      Note

      To restore the database:

      $ docker exec -i proj_database_1 mongorestore --drop --gzip \
      --archive --ssl --sslAllowInvalidCertificates < ~/pre_upgrade
      
    • To use the default configuration, rename the database in MongoDB from shrimp to decapod and back up the data.

      1. Rename the database:

        $ docker-compose -p PROJ exec database moshell
        MongoDB shell version: 3.2.10
        connecting to: false
        2017-02-14T06:38:15.400+0000 W NETWORK  [thread1] The server \
        certificate does not match the host name 127.0.0.1
        Welcome to the MongoDB shell.
        For interactive help, type "help".
        For more comprehensive documentation, see
                http://docs.mongodb.org/
        Questions? Try the support group
                http://groups.google.com/group/mongodb-user
        Server has startup warnings:
        2017-02-14T06:20:54.806+0000 I CONTROL  [initandlisten]
        2017-02-14T06:20:54.806+0000 I CONTROL  [initandlisten] ** WARNING:\
         /sys/kernel/mm/transparent_hugepage/enabled is 'always'.
        2017-02-14T06:20:54.806+0000 I CONTROL  [initandlisten] **        \
        We suggest setting it to 'never'
        2017-02-14T06:20:54.806+0000 I CONTROL  [initandlisten]
        2017-02-14T06:20:54.806+0000 I CONTROL  [initandlisten] ** WARNING:\
         /sys/kernel/mm/transparent_hugepage/defrag is 'always'.
        2017-02-14T06:20:54.806+0000 I CONTROL  [initandlisten] **        \
        We suggest setting it to 'never'
        2017-02-14T06:20:54.806+0000 I CONTROL  [initandlisten]
        > db.copyDatabase("shrimp", "decapod", "localhost")
        { "ok" : 1 }
        > use shrimp
        switched to db shrimp
        > db.dropDatabase()
        { "dropped" : "shrimp", "ok" : 1 }
        
      2. Back up the database:

        $ docker exec -i proj_database_1 mongodump --gzip --archive --ssl \
        --sslAllowInvalidCertificates > ~/pre_upgrade_renamed
        
  2. Optional. If you have modified any configuration files such as config.yaml or id_rsa, copy the files to a custom directory, for example, ~/decapod_runtime. To do so, run the following commands from the same directory used to run Decapod 0.1:

    $ mkdir ~/decapod_runtime
    $ docker cp "$(docker-compose -p PROJ ps -q api):/etc/shrimp/config.yaml" ~/decapod_runtime
    $ docker cp "$(docker-compose -p PROJ ps -q controller):/root/.ssh/id_rsa" ~/decapod_runtime
    $ docker cp "$(docker-compose -p PROJ ps -q frontend):/ssl/dhparam.pem" ~/decapod_runtime
    $ docker cp "$(docker-compose -p PROJ ps -q frontend):/ssl/ssl.crt" ~/decapod_runtime
    $ docker cp "$(docker-compose -p PROJ ps -q frontend):/ssl/ssl.key" ~/decapod_runtime
    $ docker cp "$(docker-compose -p PROJ ps -q database):/certs/mongodb.pem" ~/decapod_runtime
    $ docker cp "$(docker-compose -p PROJ ps -q database):/certs/mongodb-ca.crt" ~/decapod_runtime
    

    Note

    If you did not generate any custom configuration files and used the default configuration, skip this step and proceed to step 4.

  3. Obtain the Decapod 1.0.0 images. To do so, follow steps 1-2 in the Install Decapod section of MCP Deployment Guide.

    Note

    The required configuration files are stored in ~/decapod_runtime and the repository for Decapod 1.0.0 is cloned to ~/decapod as described in Prerequisites.

  4. Stop and remove containers for version 0.1.x. Since Docker containers are stateless and you have created a backup of the state (the database backup), drop the existing containers and start new ones. Execute the following command from the directory where you run Decapod:

    $ docker-compose -p PROJ down -v
    
  5. Run Decapod 1.0.0.

    1. Change the directory to ~/decapod_runtime.

    2. Run Decapod:

      $ docker-compose -p PROJ up --remove-orphans -d
      
  6. Restore the database:

    $ docker exec -i $(docker-compose -p PROJ ps -q admin) decapod-admin db \
    restore < ~/pre_upgrade_renamed
    

    Alternatively, if you did not rename the database:

    $ docker exec -i (docker-compose -p PROJ ps admin) decapod-admin db restore < ~/pre_upgrade
    
  7. Apply migrations:

    $ docker-compose -p PROJ exec admin decapod-admin migration apply
    
  8. Optional. You can configure MongoDB to be not backward compatible with the previous release. To do so, run:

    $ docker-compose -p PROJ exec database moshell
    MongoDB server version: 3.4.2
    Welcome to the MongoDB shell.
    For interactive help, type "help".
    For more comprehensive documentation, see
            http://docs.mongodb.org/
    Questions? Try the support group
            http://groups.google.com/group/mongodb-user
    Server has startup warnings:
    2017-02-14T07:00:13.729+0000 I STORAGE  [initandlisten]
    2017-02-14T07:00:13.730+0000 I STORAGE  [initandlisten] ** WARNING: \
    Using the XFS filesystem is strongly recommended with the WiredTiger storage engine
    2017-02-14T07:00:13.730+0000 I STORAGE  [initandlisten] **          \
    See http://dochub.mongodb.org/core/prodnotes-filesystem
    2017-02-14T07:00:15.199+0000 I CONTROL  [initandlisten]
    2017-02-14T07:00:15.199+0000 I CONTROL  [initandlisten] ** WARNING: \
    Access control is not enabled for the database.
    2017-02-14T07:00:15.199+0000 I CONTROL  [initandlisten] **          \
    Read and write access to data and configuration is unrestricted.
    2017-02-14T07:00:15.199+0000 I CONTROL  [initandlisten]
    2017-02-14T07:00:15.199+0000 I CONTROL  [initandlisten]
    2017-02-14T07:00:15.199+0000 I CONTROL  [initandlisten] ** WARNING: \
    /sys/kernel/mm/transparent_hugepage/enabled is 'always'.
    2017-02-14T07:00:15.199+0000 I CONTROL  [initandlisten] **        \
    We suggest setting it to 'never'
    2017-02-14T07:00:15.199+0000 I CONTROL  [initandlisten]
    2017-02-14T07:00:15.199+0000 I CONTROL  [initandlisten] ** WARNING: \
    /sys/kernel/mm/transparent_hugepage/defrag is 'always'.
    2017-02-14T07:00:15.199+0000 I CONTROL  [initandlisten] **        \
    We suggest setting it to 'never'
    2017-02-14T07:00:15.199+0000 I CONTROL  [initandlisten]
    > db.adminCommand({setFeatureCompatibilityVersion: "3.4"})
    { "ok" : 1  }
    
  9. Optional. Change the root password as described in Reset password.