Last active
February 15, 2022 11:21
-
-
Save ijokarumawak/23c2e8ba65e95341bfcf to your computer and use it in GitHub Desktop.
Couchbase Day on ECS
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
#!/bin/sh | |
TASK_NAME=$1 | |
if [ -z $TASK_NAME ] | |
then | |
echo ERR: missing task_name | |
echo usage: ecs_set_docker_hosts.sh task_name | |
exit 1 | |
fi | |
for i in `docker ps |grep ${TASK_NAME} |awk '{print $1}'` | |
do | |
C_IP=`docker inspect --format '{{.NetworkSettings.IPAddress}}' $i` | |
C_NAME=`docker inspect --format '{{.Config.Hostname}}' $i` | |
for j in `docker ps |grep ${TASK_NAME} |awk '{print $1}'` | |
do | |
if [ $i != $j ] | |
then | |
echo writing $j host... | |
echo -e "${C_IP}\\t${C_NAME}" | |
docker exec $j sh -c "echo \\"${C_IP}\\\\t${C_NAME}\\" >> /etc/hosts" | |
fi | |
done | |
done |
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
#!/bin/bash | |
APP=`docker ps |grep app-server |awk '{print $1}'`; docker exec -d ${APP} sh -c 'node app.js >> app.log 2>&1' |
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
#!/bin/sh | |
# Initialize Node | |
curl -v -X POST \ | |
localhost:8091/nodes/self/controller/settings \ | |
-d data_path=/opt/couchbase/var/lib/couchbase/data \ | |
-d index_path=/opt/couchbase/var/lib/couchbase/data | |
# Rename Node | |
curl -v -X POST \ | |
localhost:8091/node/controller/rename \ | |
-d hostname=cb-1.cbday | |
# RAM quota settings | |
curl -v -X POST \ | |
localhost:8091/pools/default \ | |
-d memoryQuota=1024 \ | |
-d indexMemoryQuota=256 | |
# Setup Services | |
curl -v -X POST \ | |
localhost:8091/node/controller/setupServices \ | |
-d services=kv,index,n1ql | |
# Admin user | |
curl -v -X POST \ | |
localhost:8091/settings/web \ | |
-d password=password \ | |
-d username=Administrator \ | |
-d port=8091 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment