-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1469 from amaltaro/fix-11944-take2
Set WMAgent/MariaDB/CouchDB user during container runtime
- Loading branch information
Showing
14 changed files
with
235 additions
and
217 deletions.
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,36 @@ | ||
#!/bin/bash | ||
|
||
manage init | tee -a $COUCH_LOG_DIR/run.log | ||
manage start | tee -a $COUCH_LOG_DIR/run.log | ||
manage pushapps | tee -a $COUCH_LOG_DIR/run.log | ||
# Basic initialization for CouchDB | ||
thisUser=$(id -un) | ||
thisGroup=$(id -gn) | ||
thisUserID=$(id -u) | ||
thisGroupID=$(id -g) | ||
echo "Running CouchDB container with user: $thisUser (ID: $thisUserID) and group: $thisGroup (ID: $thisGroupID)" | ||
|
||
echo "start sleeping....zzz" | ||
while true; do sleep 10; done | ||
export USER=$thisUser | ||
[[ -d ${HOME} ]] || mkdir -p ${HOME} | ||
|
||
<<EOF cat >> ~/.bashrc | ||
export USER=$thisUser | ||
# # start the service | ||
# manage start | ||
alias lll="ls -lathr" | ||
alias ls="ls --color=auto" | ||
alias ll='ls -la --color=auto' | ||
alias scurl='curl -k --cert ${COUCH_CERTS_DIR}/servicecert.pem --key ${COUCH_CERTS_DIR}/servicekey.pem' | ||
alias manage=$COUCH_MANAGE_DIR/manage | ||
# Set command prompt for the running user inside the container | ||
export PS1="(CouchDB-$TAG) [\u@\h:\W]\$ " | ||
EOF | ||
source ${HOME}/.bashrc | ||
|
||
manage init | tee -a $COUCH_LOG_DIR/run.log | ||
manage start | tee -a $COUCH_LOG_DIR/run.log | ||
manage pushapps | tee -a $COUCH_LOG_DIR/run.log | ||
|
||
echo "start sleeping....zzz" | ||
sleep infinity | ||
|
||
# ########################################################################################### | ||
# # NOTE: Leftovers - to be adopted/reimplemented in the GH issue dealing with CouchDB setup | ||
# # all of those steps were previously done with the old wmagent deployment procedures | ||
# ########################################################################################### | ||
|
||
# DATA_SIZE=`lsblk -bo SIZE,MOUNTPOINT | grep ' /data1' | sort | uniq | awk '{print $1}'` | ||
# DATA_SIZE_GB=`lsblk -o SIZE,MOUNTPOINT | grep ' /data1' | sort | uniq | awk '{print $1}'` | ||
# if [[ $DATA_SIZE -gt 200000000000 ]]; then # greater than ~200GB | ||
# echo "Partition /data1 available! Total size: $DATA_SIZE_GB" | ||
# sleep 0.5 | ||
# while true; do | ||
# read -p "Would you like to deploy couchdb in this /data1 partition (yes/no)? " yn | ||
# case $yn in | ||
# [Y/y]* ) DATA1=true; break;; | ||
# [N/n]* ) DATA1=false; break;; | ||
# * ) echo "Please answer yes or no.";; | ||
# esac | ||
# done | ||
# else | ||
# DATA1=false | ||
# fi && echo | ||
|
||
# echo -e "\n*** Applying (for couchdb1.6, etc) cert file permission ***" | ||
# chmod 600 /data/certs/service{cert,key}.pem | ||
# echo "Done!" | ||
|
||
# echo "*** Checking if couchdb migration is needed ***" | ||
# echo -e "\n[query_server_config]\nos_process_limit = 50" >> $WMA_CURRENT_DIR/config/couchdb/local.ini | ||
# if [ "$DATA1" = true ]; then | ||
# ./manage stop-services | ||
# sleep 5 | ||
# if [ -d "/data1/database/" ]; then | ||
# echo "Moving old database away... " | ||
# mv /data1/database/ /data1/database_old/ | ||
# FINAL_MSG="5) Remove the old database when possible (/data1/database_old/)" | ||
# fi | ||
# rsync --remove-source-files -avr /data/srv/wmagent/current/install/couchdb/database /data1 | ||
# sed -i "s+database_dir = .*+database_dir = /data1/database+" $WMA_CURRENT_DIR/config/couchdb/local.ini | ||
# sed -i "s+view_index_dir = .*+view_index_dir = /data1/database+" $WMA_CURRENT_DIR/config/couchdb/local.ini | ||
# ./manage start-services | ||
# fi | ||
# echo "Done!" && echo | ||
# ########################################################################################### | ||
# # start the service | ||
# manage start |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,31 @@ | ||
#!/bin/bash | ||
|
||
# Basic initialization for MariaDB | ||
thisUser=$(id -un) | ||
thisGroup=$(id -gn) | ||
thisUserID=$(id -u) | ||
thisGroupID=$(id -g) | ||
echo "Running MariaDB container with user: $thisUser (ID: $thisUserID) and group: $thisGroup (ID: $thisGroupID)" | ||
|
||
export USER=$thisUser | ||
[[ -d ${HOME} ]] || mkdir -p ${HOME} | ||
|
||
<<EOF cat >> ~/.bashrc | ||
export USER=$thisUser | ||
alias lll="ls -lathr" | ||
alias ls="ls --color=auto" | ||
alias ll='ls -la --color=auto' | ||
alias manage=$MDB_MANAGE_DIR/manage | ||
# Set command prompt for the running user inside the container | ||
export PS1="(MariaDB-$MDB_TAG) [\u@\h:\W]\$ " | ||
EOF | ||
source ${HOME}/.bashrc | ||
|
||
manage init-mariadb 2>&1 | tee -a $MDB_LOG_DIR/run.log | ||
manage start-mariadb 2>&1 | tee -a $MDB_LOG_DIR/run.log | ||
|
||
echo "Start sleeping....zzz" | ||
while true; do sleep 10; done | ||
sleep infinity |
Oops, something went wrong.