[FIX] Armhf snap build (#11268)

* Update snapcraft.yaml

* Add node prep script

* Make executable

* Remove devDependency that caused arm failure.  Also removed packaged binary for sharp for arm

* dev/null tar stdout.  Remove sharp vendor folder only for arm so it will download and build

* add missing slash

* fix arm check to catch armv7l also

* remove /dev/null and verbose flag.

* Move extract to new line
pull/11277/head
Aaron Ogle 8 years ago committed by Rodrigo Nascimento
parent 204baf6846
commit 445ef8bb92
  1. 61
      .snapcraft/README.md
  2. 14
      .snapcraft/resources/prepareRocketChat
  3. 23
      .snapcraft/resources/preparenode
  4. 2
      .snapcraft/snapcraft.yaml

@ -1,61 +0,0 @@
![Rocket.Chat logo](https://rocket.chat/images/logo/logo-dark.svg?v3)
# rocketchat-server snap for Ubuntu Core (all arch)
Features:
* bundles ubuntu distribution specific and RC compatible mongodb version
* oplog tailing for mongo by default
* mongodb backup command
* mongodb restore command
* caddy reverse proxy built-in - capable of handling free lestencrypt ssl
Note:
Currently, this repository is mirrored on launchpad, and used to build latest ARMHF and i386 snaps.
You can download recent builds here:
https://code.launchpad.net/~sing-li/+snap/rocketchat-server
Due an issue with the existing installed base of amd64 users (existing snap always installed mongodb 3.2 [#issue](https://github.com/RocketChat/rocketchat-server-snap/issues/3)), this snap is not currently used for amd64 builds.
### Test installation
Download the latest snap file of the corresponding architecture to your Ubuntu Core 16 or 16.04LTS server.
`sudo snap install ./rocketchat-server-xxxxxxxx.snap --dangerous`
### Development or compile your own snap
Make sure you have `snapcraft` installed.
```
git clone https://github.com/RocketChat/rocketchat-server-snap
cd rocketchat-server-snap
snapcraft snap
```
### Regression tests (run for amd64, i386 and armhf):
- snapcraft runs properly
- snap installs properly
- all services start automatically
- rc service shows a 5-second restart delay while waiting for mongo
- to test manually, stop rc, stop mongo, start rc, wait 20s or so, start mongo
- rc can be successfully restarted via the "Restart the server" button under Admin > Settings > General
- rc service shows a 5-second delay when restarted via this button
- all commands execute successfully:
- initcaddy
- modify the Caddyfile to test:
- self-signed TLS certificate (use the "tls self_signed" caddy directive)
- changing ports (with and without TLS)
- using IP address (only works without TLS)
- successfully acquiring a Let's Encrypt certificate (requires a registered domain)
- backupdb
- should run only with sudo
- restoredb
- ideally, stop rc service prior to running this (mongo must be running)
- should run only with sudo
- use any file outside of $snap_common (should fail)
- use the file created with backupdb
- use a dummy .tgz file without actual data
- with and without a "parties" directory in the archive

@ -2,11 +2,18 @@
curl -SLf "https://releases.rocket.chat/#{RC_VERSION}/download/" -o rocket.chat.tgz
tar xvf rocket.chat.tgz --strip 1
tar xf rocket.chat.tgz --strip 1
cd programs/server
rm -rf npm/node_modules/meteor/emojione_emojione/node_modules/grunt-contrib-qunit
npm install
if [[ $(uname -m) == *armv6l* ]] || [[ $(uname -m) == *armv7l* ]]
then
rm -rf npm/node_modules/sharp/vendor
fi
export NODE_ENV=production
npm i
# Ideally this will go away. For some reason on install its installing node-v57-linux-x64-glibc but when actually running it is looking for node-v57-linux-x64-unknown
if [[ $(uname -m) == "x86_64" ]]
@ -15,4 +22,5 @@ then
fi
# sharp needs execution stack removed - https://forum.snapcraft.io/t/snap-and-executable-stacks/1812
execstack --clear-execstack npm/node_modules/sharp/vendor/lib/librsvg-2.so.2.42.0
ls -l npm/node_modules/sharp/vendor
execstack --clear-execstack npm/node_modules/sharp/vendor/lib/librsvg-2.so*

@ -0,0 +1,23 @@
#!/bin/bash
node_version="v8.11.3"
unamem="$(uname -m)"
if [[ $unamem == *aarch64* ]]; then
node_arch="arm64"
elif [[ $unamem == *64* ]]; then
node_arch="x64"
elif [[ $unamem == *86* ]]; then
node_arch="x86"
elif [[ $unamem == *armv6l* ]]; then
node_arch="armv6l"
elif [[ $unamem == *armv7l* ]]; then
node_arch="armv7l"
else
echo "Aborted, unsupported or unknown architecture: $unamem"
return 2
fi
wget https://nodejs.org/dist/$node_version/node-$node_version-linux-$node_arch.tar.xz
tar xf node-$node_version-linux-$node_arch.tar.xz --strip 1

@ -39,7 +39,7 @@ apps:
parts:
node:
plugin: dump
prepare: wget https://nodejs.org/dist/v8.11.2/node-v8.11.2-linux-x64.tar.xz; tar xvf node-v8.11.2-linux-x64.tar.xz --strip 1;
prepare: ./resources/preparenode
build-packages:
# For fibers
- python

Loading…
Cancel
Save