Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .snapcraft/resources/prepareRocketChat
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

curl -SLf "https://releases.rocket.chat/#{RC_VERSION}/download/" -o rocket.chat.tgz
curl -SLf "https://releases.rocket.chat/1.3.2/download/" -o rocket.chat.tgz

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
curl -SLf "https://releases.rocket.chat/1.3.2/download/" -o rocket.chat.tgz
curl -SLf "https://releases.rocket.chat/#{RC_VERSION}/download/" -o rocket.chat.tgz

Before we merge we'll need to make sure to change this back. Can leave for now while testing


tar xf rocket.chat.tgz --strip 1

Expand Down Expand Up @@ -29,4 +29,5 @@ execstack --clear-execstack npm/node_modules/sharp/vendor/lib/librsvg-2.so*
# Having to manually remove because of latest warning
rm -rf npm/node_modules/meteor/konecty_user-presence/node_modules/colors/lib/.colors.js.swp
rm -rf node_modules/node-pre-gyp/node_modules/tar/lib/.mkdir.js.swp

rm -rf npm/node_modules/sharp/node_modules/semver/bin/.semver.js.swp
rm -rf npm/node_modules/tar/lib/.mkdir.js.swp
2 changes: 1 addition & 1 deletion .snapcraft/resources/preparenode
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

node_version="v8.15.1"
node_version="v8.11.4"

unamem="$(uname -m)"
if [[ $unamem == *aarch64* ]]; then
Expand Down
5 changes: 5 additions & 0 deletions .snapcraft/resources/startRocketChat
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ try_times=0

function try_start {

refreshing="$(snapctl get snap-refreshing)"
if [ $refreshing == "true" ]; then
exit 0
fi

search=$(ps --pid $(cat $SNAP_COMMON/mongod.pid) -o comm=)

if [ $search ]
Expand Down
9 changes: 9 additions & 0 deletions .snapcraft/snap/hooks/configure
Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,12 @@ else
fi
fi

# Obtain backup value
backup="$(snapctl get backup-on-refresh)"
# Validate it
backup_regex='((enable)|(disable))'
if ! [[ $backup =~ $backup_regex ]] ; then
echo "\"$backup\" should be enable or disable" >&2
exit 1
fi

7 changes: 7 additions & 0 deletions .snapcraft/snap/hooks/install
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,10 @@ snapctl set mongo-oplog-url=mongodb://localhost:27017/local

# Initialize the protocol to a default
snapctl set https=disable

# Initialize backup to a default
snapctl set backup-on-refresh=enable

# Initialize snap-refreshing to false
snapctl set snap-refreshing=false

6 changes: 6 additions & 0 deletions .snapcraft/snap/hooks/post-refresh
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,9 @@ if [ -z "$https" ]; then
snapctl set https=disable
fi

# Initialize backup to a default
snapctl set backup-on-refresh=enable

# Set back snap-refreshing to false
snapctl set snap-refreshing=false

22 changes: 22 additions & 0 deletions .snapcraft/snap/hooks/pre-refresh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

export PATH="$SNAP/usr/sbin:$SNAP/usr/bin:$SNAP/sbin:$SNAP/bin:$PATH"
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$SNAP/lib:$SNAP/usr/lib:$SNAP/lib/x86_64-linux-gnu:$SNAP/usr/lib/x86_64-linux-gnu"
export LD_LIBRARY_PATH=$SNAP_LIBRARY_PATH:$LD_LIBRARY_PATH

TIMESTAMP=$(date +"%Y%m%d.%H%M")

# stop rocketchat
snapctl set snap-refreshing=true

rocketchatpid=$(pgrep -f "node $SNAP/main.js")
kill -9 $rocketchatpid
if ! [ $? == 0 ]; then
echo "Failed to stop rocketchat service" > $SNAP_COMMON/refresh_${TIMESTAMP}.log
fi

backupdb
if ! [ $? == 0 ]; then
echo "Failed rocketchat database backup before refresh" >> $SNAP_COMMON/refresh_${TIMESTAMP}.log
fi

4 changes: 3 additions & 1 deletion .snapcraft/snap/snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# 5. `snapcraft snap`

name: rocketchat-server
version: #{RC_VERSION}
version: 1.3.2

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
version: 1.3.2
version: #{RC_VERSION}

Before we merge we'll need to make sure to change this back. Can leave for now while testing

summary: Rocket.Chat server
description: Have your own Slack like online chat, built with Meteor. https://rocket.chat/
confinement: strict
Expand Down Expand Up @@ -39,6 +39,8 @@ apps:
hooks:
configure:
plugs: [network]
pre-refresh:
plugs: [network]
parts:
node:
plugin: dump
Expand Down