Created
March 15, 2018 22:49
-
-
Save danieljue/93e484de9ca9038a98526bf302390abe to your computer and use it in GitHub Desktop.
A partial script for installing the dynamo-db janusgraph EC2 instance via aws cloud formation. Paste this into your dynamodb-janusgraph-storage-backend-cfn.yaml, replacing the existing one. Fixes a java mismatch with maven during gremlin install.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UserData: | |
Fn::Base64: | |
Fn::Join: | |
- '' | |
- - "#!/bin/bash\n" | |
- "export SDKMAN_DIR=/usr/local/sdkman && curl -s https://get.sdkman.io | bash && source /usr/local/sdkman/bin/sdkman-init.sh\n" | |
- "echo 'export SDKMAN_DIR=/usr/local/sdkman; source /usr/local/sdkman/bin/sdkman-init.sh' > /etc/profile.d/sdkman.sh\n" | |
- "yum update -y && yum upgrade -y && yum install -y java-1.8.0-openjdk > /home/ec2-user/yumupdates.log\n" | |
- "yum remove -y java-1.7.0-openjdk > /home/ec2-user/yumremovejava7.log\n" | |
- "java -version > /home/ec2-user/java-version-before-sdkmvn.log\n" | |
- "sdk install java < /dev/null\n" | |
- "sdk current java > /home/ec2-user/java-version-from-sdkman.log\n" | |
- "sdk install maven < /dev/null && set -x\n" | |
- "mvn -version > /home/ec2-user/maven-installation-settings.log\n" | |
- "export GREMLIN_SERVER_USERNAME='ec2-user'\n" | |
- "export LOG_DIR=/var/log/gremlin-server\n" | |
- "export SERVER_DIRNAME=dynamodb-janusgraph-storage-backend-1.2.0\n" | |
- "export SERVER_ZIP=${SERVER_DIRNAME}.zip\n" | |
- "export PACKAGES_DIR=/usr/local/packages\n" | |
- "export INSTALL_DIR=${PACKAGES_DIR}/${SERVER_DIRNAME}\n" | |
- "export REPO_ARCHIVE_DIR=/dev/shm/dynamodb-janusgraph-storage-backend-master\n" | |
- "mkdir -p ${LOG_DIR} ${INSTALL_DIR}\n" | |
- "export SERVICE_SCRIPT=${INSTALL_DIR}/bin/gremlin-server-service.sh\n" | |
- "pushd /dev/shm\n" | |
- "wget https://github.com/awslabs/dynamodb-janusgraph-storage-backend/archive/master.zip && unzip -q master.zip\n" | |
- "pushd ${REPO_ARCHIVE_DIR}\n" | |
- "src/test/resources/install-gremlin-server.sh > /home/ec2-user/gremlin-server-installation.log && popd && popd\n" | |
- "pushd ${PACKAGES_DIR}\n" | |
- "mv ${REPO_ARCHIVE_DIR}/server/${SERVER_DIRNAME} . && rm -rf /dev/shm/* && chmod u+x ${SERVICE_SCRIPT} && ln -s ${SERVICE_SCRIPT} /etc/init.d/gremlin-server && chkconfig --add gremlin-server\n" | |
- "export BACKEND_PROPERTIES=${INSTALL_DIR}/conf/gremlin-server/dynamodb.properties\n" | |
- "aws s3 cp " | |
- Ref: "StorageBackendPropertiesFileS3Url" | |
- " ${BACKEND_PROPERTIES}\n" | |
- "chown -R ${GREMLIN_SERVER_USERNAME}:${GREMLIN_SERVER_USERNAME} ${LOG_DIR} ${INSTALL_DIR}\n" | |
- "ln -s ${INSTALL_DIR}/conf /home/ec2-user/conf && chmod a+r /home/ec2-user/conf\n" | |
- "service gremlin-server start > /home/ec2-user/gremlin-server-start.log\n\n" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
One more issue I faced when installing on t2.micro is space on "/dev/shm" which causes failure of script.
Can we move to "/tmp" so that it can work on all types of instances.