Jordan Halterman | 00e92da | 2018-05-22 23:05:52 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # ----------------------------------------------------------------------------- |
| 3 | # Remotely configures & starts Atomix for the first time. |
| 4 | # ----------------------------------------------------------------------------- |
| 5 | |
| 6 | function _usage () { |
| 7 | cat << _EOF_ |
| 8 | usage: |
| 9 | $(basename $0) [node] |
| 10 | |
| 11 | options: |
| 12 | - [node] : The node to configure |
| 13 | |
| 14 | summary: |
| 15 | Remotely configures and starts Atomix for the first time. |
| 16 | |
| 17 | The procedure for configuring a node includes determining base features, |
| 18 | applications to load at startup, and clustering and logical network view |
| 19 | configurations, among others. |
| 20 | |
| 21 | If [node] isn't specified, the default target becomes \$OCI. |
| 22 | |
| 23 | _EOF_ |
| 24 | } |
| 25 | |
| 26 | [ "$1" = "-h" ] && _usage && exit 0 |
| 27 | |
| 28 | [ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1 |
| 29 | . $ONOS_ROOT/tools/build/envDefaults |
| 30 | |
| 31 | node=${1:-$OCI} |
| 32 | remote=$ONOS_USER@$node |
| 33 | |
| 34 | # Generate a default cluster.json from the ON* environment variables |
| 35 | CDEF_FILE=/tmp/${remote}.atomix.json |
| 36 | atomix-gen-config $node $CDEF_FILE |
| 37 | scp -q $CDEF_FILE $remote:$ATOMIX_INSTALL_DIR/atomix.json |
| 38 | |
| 39 | ssh -tt $ONOS_USER@$node " |
| 40 | echo \"cd $ATOMIX_INSTALL_DIR && java -Xms4G -Xmx4G -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode -cp .:$ATOMIX_INSTALL_DIR/atomix.json:$ATOMIX_INSTALL_DIR/atomix-agent.jar -Datomix.logging.level=DEBUG io.atomix.agent.AtomixAgent\" > $ATOMIX_INSTALL_DIR/atomix && sudo chmod u+x $ATOMIX_INSTALL_DIR/atomix |
| 41 | " |