Skip to content
This repository has been archived by the owner on May 4, 2019. It is now read-only.

Commit

Permalink
#101 Create a script that alerts devs (#109)
Browse files Browse the repository at this point in the history
Fixes #101
  • Loading branch information
deeptibaghel authored and vladikoff committed Jul 11, 2018
1 parent 9325ebf commit f9a98f6
Show file tree
Hide file tree
Showing 11 changed files with 94 additions and 28 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Expand Up @@ -29,12 +29,12 @@ matrix:
- fast_finish: true

before_install:
- npm i -g npm@5
- npm i -g npm@6
- if [[ $TRAVIS_OS_NAME == "osx" ]]; then brew install graphicsmagick; fi

install:
- PATH="`npm bin`:`npm bin -g`:$PATH"
- npm install -g npm@5
- npm install -g npm@6
- node --version
- npm --version

Expand Down
14 changes: 3 additions & 11 deletions README.md
Expand Up @@ -81,17 +81,13 @@ If you get an `error` status for any of the servers please verify that you insta
### Dependencies
> Required developer dependencies:
[Git](http://git-scm.com/book/en/v2/Getting-Started-Installing-Git),
[node.js **8+**, with npm 5](http://nodejs.org/),
[node.js **8+** with npm 6](http://nodejs.org/),
[Python 2.6+](https://www.python.org/),
[Java 8+](https://www.java.com/en/download/),
[Redis](http://redis.io/),
[libgmp](https://gmplib.org/),
[graphicsmagick](http://www.graphicsmagick.org/),
[memcached](https://memcached.org/),
[docker](https://docs.docker.com/).

**Note:** Please use Node.js 8+.

##### OS X (with [Brew](http://brew.sh/)):

[Xcode and OS X Command Line Tools are required](https://developer.apple.com/xcode/), install it and verify that command line tools installed:
Expand All @@ -100,15 +96,14 @@ xcode-select --install
```
then:
```
brew install gmp redis graphicsmagick memcached
sudo easy_install pip && sudo pip install virtualenv
```
[Install Docker for Mac](https://docs.docker.com/docker-for-mac/install/)

##### Ubuntu:
```
sudo apt-get install build-essential git-core libgmp3-dev graphicsmagick redis-server python-virtualenv
python-dev memcached docker-ce
sudo apt-get install build-essential git-core libgmp3-dev graphicsmagick python-virtualenv
python-dev docker-ce
```
Docker commands require sudo, to avoid it, follow steps below:
1. Add the docker group if it doesn't already exist
Expand All @@ -129,9 +124,6 @@ sudo service docker restart
> NOTE: If you are experienced with Node.js: Use [nvm](https://github.com/creationix/nvm) to force node 8
just for `fxa-local-dev` using `nvm use 8`. (Install it first with `nvm install 8`)

##### OS X
Use this if you do not rely on other node.js programs on your system: Find the latest Node 8 LTS `.pkg` download at [nodejs.org/en/download/](https://nodejs.org/en/download/) and install it.

##### Ubuntu / Debian:

```
Expand Down
48 changes: 48 additions & 0 deletions _scripts/check.sh
@@ -0,0 +1,48 @@
#!/usr/bin/env bash
if [[ $(which node) && $(node --version) ]]; then
node _scripts/check_node_version.js
else
echo "install node to continue installation"
echo "https://nodejs.org"
exit 1
fi

if [[ $(which docker) && $(docker --version) ]]; then
docker=y
else
docker=n
fi

os="$(uname -a | cut -f 1 -d ' ')"
if [ "$os" = "Darwin" ]; then
if [ "$docker" = "n" ]; then
echo "install docker to continue installation"
echo "https://docs.docker.com/docker-for-mac/install/"
exit 1
fi

if [[ $(which brew) && $(brew --version) ]]; then
if [[ $(brew ls --versions gmp) ]]; then
echo "gmp is installed"
else
brew install gmp
fi
if [[ $(brew ls --versions graphicsmagick) ]]; then
echo "graphicsmagick is installed"
else
brew install graphicsmagick
fi
else
echo "install homebrew to continue installation"
echo "https://brew.sh/"
exit 1
fi
elif [ "$os" = "Linux" ]; then
if [ "$docker" = "n" ]; then
echo "install docker to continue installation using the steps below:"
echo "sudo apt-get install docker-ce"
echo "sudo groupadd docker"
echo "sudo gpasswd -a $USER docker"
echo "sudo service docker restart"
fi
fi
33 changes: 33 additions & 0 deletions _scripts/check_node_version.js
@@ -0,0 +1,33 @@
const check = require("check-node-version");

check(
{ node: ">= 8", npm: ">= 6" },
(error, results) => {
if (error) {
console.error(error);
return;
}

if (results.isSatisfied) {
console.log("Node and nvm version ok");
return;
}

console.error("Some package version(s) failed!");

for (const packageName of Object.keys(results.versions)) {
if (!results.versions[packageName].isSatisfied) {
if(packageName === 'npm')
console.error(`Npm version must be > 6 . Run the following command to upgrade npm "npm i -g npm@6"`);
else if(packageName === 'node')
console.error(`Node version must be > 8`);
if(process.platform === 'darwin')
console.log("Use this if you do not rely on other node.js programs on your system: Find the latest Node 8 LTS .pkg download at nodejs.org/en/download/ and install it.")
else
console.error(`Missing ${packageName}.`);

process.exit(1);
}
}
}
);
3 changes: 3 additions & 0 deletions _scripts/install_all.sh
@@ -1,4 +1,5 @@
#!/bin/sh -ex
_scripts/check.sh

# Set ulimit, need it for npm
ulimit -S -n 2048 || echo "Setting ulimit failed"
Expand Down Expand Up @@ -48,6 +49,8 @@ cd fxa-basket-proxy; npm i; cd ..

cd 123done; npm i; cd ..

docker pull memcached

docker pull mozilla/syncserver

docker pull pafortin/goaws
Expand Down
5 changes: 0 additions & 5 deletions _scripts/memcached.js

This file was deleted.

1 change: 1 addition & 0 deletions _scripts/memcached.sh
@@ -0,0 +1 @@
docker run --rm --name memcache memcached
6 changes: 0 additions & 6 deletions _scripts/redis.js

This file was deleted.

4 changes: 2 additions & 2 deletions mysql_servers.json
Expand Up @@ -174,7 +174,7 @@
},
{
"name": "memcached PORT 11211",
"script": "_scripts/memcached.js",
"script": "_scripts/memcached.sh",
"max_restarts": "1",
"min_uptime": "2m"
},
Expand All @@ -186,4 +186,4 @@
"autorestart": false
}
]
}
}
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -26,13 +26,13 @@
"dependencies": {
"bluebird": "2.10.2",
"chalk": "1.1.1",
"check-node-version": "^3.2.0",
"foxfire": "1.0.1",
"fxa-dev-launcher": "vladikoff/fxa-dev-launcher",
"internal-ip": "1.2.0",
"lodash": "4.16.2",
"minimist": "1.1.1",
"pm2": "2.9.3",
"redis-server": "1.1.0",
"replace-in-file": "0.2.1"
}
}
2 changes: 1 addition & 1 deletion servers.json
Expand Up @@ -153,7 +153,7 @@
},
{
"name": "memcached PORT 11211",
"script": "_scripts/memcached.js",
"script": "_scripts/memcached.sh",
"max_restarts": "1",
"min_uptime": "2m"
},
Expand Down

0 comments on commit f9a98f6

Please sign in to comment.