Skip to content

Commit

Permalink
feat: optimize mac deployment scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
cubxxw committed Jan 21, 2024
1 parent 6b83d8b commit 68bc62d
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 9 deletions.
2 changes: 0 additions & 2 deletions scripts/docker-start-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ openim::log::info "\n# Use Docker to start all openim service"

trap 'openim::util::onCtrlC' INT

"${OPENIM_ROOT}"/scripts/init-config.sh --skip

"${OPENIM_ROOT}"/scripts/start-all.sh

sleep 5
Expand Down
19 changes: 13 additions & 6 deletions scripts/install/openim-msgtransfer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Use:
# ./scripts/install/openim-msgtransfer.sh openim::msgtransfer::start

# Common utilities, variables and checks for all build scripts.
set -o errexit
Expand Down Expand Up @@ -64,15 +66,20 @@ function openim::msgtransfer::check() {
PIDS=$(pgrep -f "${OPENIM_OUTPUT_HOSTBIN}/openim-msgtransfer")

NUM_PROCESSES=$(echo "$PIDS" | wc -l)
# NUM_PROCESSES=$(($NUM_PROCESSES - 1))

if [ "$NUM_PROCESSES" -eq "$OPENIM_MSGGATEWAY_NUM" ]; then
openim::log::info "Found $OPENIM_MSGGATEWAY_NUM processes named $OPENIM_OUTPUT_HOSTBIN"
for PID in $PIDS; do
ps -p $PID -o pid,cmd
done
openim::log::info "Found $OPENIM_MSGGATEWAY_NUM processes named $OPENIM_OUTPUT_HOSTBIN"
for PID in $PIDS; do
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
ps -p $PID -o pid,cmd
elif [[ "$OSTYPE" == "darwin"* ]]; then
ps -p $PID -o pid,comm
else
openim::log::error "Unsupported OS type: $OSTYPE"
fi
done
else
openim::log::error_exit "Expected $OPENIM_MSGGATEWAY_NUM openim msgtransfer processes, but found $NUM_PROCESSES msgtransfer processes."
openim::log::error_exit "Expected $OPENIM_MSGGATEWAY_NUM openim msgtransfer processes, but found $NUM_PROCESSES msgtransfer processes."
fi
}

Expand Down
3 changes: 2 additions & 1 deletion scripts/install/openim-rpc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,13 @@ function openim::rpc::start() {
for ((i = 0; i < ${#OPENIM_RPC_SERVICE_LISTARIES[*]}; i++)); do
# openim::util::stop_services_with_name ${OPENIM_RPC_SERVICE_LISTARIES
openim::util::stop_services_on_ports ${OPENIM_RPC_PORT_LISTARIES[$i]}

openim::log::info "OpenIM ${OPENIM_RPC_SERVICE_LISTARIES[$i]} config path: ${OPENIM_RPC_CONFIG}"

# Get the service and Prometheus ports.
OPENIM_RPC_SERVICE_PORTS=( $(openim::util::list-to-string ${OPENIM_RPC_PORT_LISTARIES[$i]}) )
read -a OPENIM_RPC_SERVICE_PORTS_ARRAY <<< ${OPENIM_RPC_SERVICE_PORTS}

OPENIM_RPC_PROM_PORTS=( $(openim::util::list-to-string ${OPENIM_RPC_PROM_PORT_LISTARIES[$i]}) )
read -a OPENIM_RPC_PROM_PORTS_ARRAY <<< ${OPENIM_RPC_PROM_PORTS}

Expand Down
2 changes: 2 additions & 0 deletions scripts/start-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ if [[ $? -ne 0 ]]; then
fi
set -o errexit

"${OPENIM_ROOT}"/scripts/init-config.sh --skip

echo "You need to start the following scripts in order: ${OPENIM_SERVER_SCRIPTARIES[@]}"
openim::log::install_errexit

Expand Down

0 comments on commit 68bc62d

Please sign in to comment.