From 164bc13c95522ae5fa9afe68c9180fddc15e543d Mon Sep 17 00:00:00 2001 From: Shreyas Patil Date: Mon, 12 Sep 2016 11:19:34 +0530 Subject: [PATCH] Fix nodejs (#310) * [Fix] Do not validate certificates while downloading node bash script * [Fix] New nodejs installation procedure * [Fix] Updated message for node update to use official node package manager scripts * [Fix] Add travis build status to repo page --- README.md | 4 ++-- bench/patches/v4/update_node.py | 15 +++++++++------ playbooks/develop/centos.yml | 15 ++++++++------- playbooks/develop/debian.yml | 24 +++++++++++++++--------- playbooks/develop/ubuntu.yml | 20 +++++++++++++------- 5 files changed, 47 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index ac611727..1b29a711 100755 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -Bench +Bench [![Build Status](https://travis-ci.org/frappe/bench.svg?branch=master)](https://travis-ci.org/frappe/bench) ===== The bench allows you to setup Frappe / ERPNext apps on your local Linux (CentOS 6, Debian 7, Ubuntu, etc) machine or a production server. You can use the bench to serve multiple frappe sites. If you are using a DigitalOcean droplet or any other VPS / Dedicated Server, make sure it has >= 1Gb of ram or has swap setup properly. @@ -15,7 +15,7 @@ Easy Setup - This is an opinionated setup with logging and SE Linux. So, it is best to setup on a blank server. - Works on Ubuntu 14.04 to 16.04, CentOS 7+, Debian 7 to 8 and MacOS X. -- You may have to install Python 2.7 (eg on Ubuntu 16.04+) by running `apt-get install python-minimal` +- You may have to install Python 2.7 (eg on Ubuntu 16.04+) by running `apt-get install python-minimal` - This script will install the pre-requisites, install bench and setup an ERPNext site - Passwords for Frappe Administrator and MariaDB (root) will be asked - You can then login as **Administrator** with the Administrator password diff --git a/bench/patches/v4/update_node.py b/bench/patches/v4/update_node.py index 58919771..b6bab199 100644 --- a/bench/patches/v4/update_node.py +++ b/bench/patches/v4/update_node.py @@ -12,9 +12,10 @@ def execute(bench_path): else: click.echo(''' No node executable was found on your machine. - Please install node 5.x before running "bench update". - Installation instructions for CentOS and Ubuntu can be found on the following link, - "https://www.metachris.com/2015/10/how-to-install-nodejs-5-on-centos-and-ubuntu/" + Please install latest node version before running "bench update". For installation instructions + please refer "Debian and Ubuntu based Linux distributions" section or "Enterprise Linux and + Fedora" section depending upon your OS on the following link, + "https://nodejs.org/en/download/package-manager/" ''') sys.exit(1) @@ -22,8 +23,10 @@ def execute(bench_path): if node_ver < expected_node_ver: click.echo(''' - Please update node version to 5.x before running "bench update". - Installation instructions for CentOS and Ubuntu can be found on the following link, - "https://www.metachris.com/2015/10/how-to-install-nodejs-5-on-centos-and-ubuntu/" + Please update node to latest version before running "bench update". + Please install latest node version before running "bench update". For installation instructions + please refer "Debian and Ubuntu based Linux distributions" section or "Enterprise Linux and + Fedora" section depending upon your OS on the following link, + "https://nodejs.org/en/download/package-manager/" ''') sys.exit(1) diff --git a/playbooks/develop/centos.yml b/playbooks/develop/centos.yml index 3bdea573..81097b1f 100755 --- a/playbooks/develop/centos.yml +++ b/playbooks/develop/centos.yml @@ -44,16 +44,17 @@ become: yes become_user: root - - name: Get nodejs 6.x bash script - get_url: - url: 'https://rpm.nodesource.com/setup_6.x' - dest: '/tmp/setup_6.x' - mode: 0644 + - name: Import Node source RPM key + rpm_key: + key: https://rpm.nodesource.com/pub/el/NODESOURCE-GPG-SIGNING-KEY-EL + state: present become: yes become_user: root - - name: Run nodejs 6.x bash script - command: /bin/bash /tmp/setup_6.x + - name: Add Node Repo + yum: + name: 'https://rpm.nodesource.com/pub_6.x/el/{{ ansible_distribution_major_version }}/{{ ansible_architecture }}/nodesource-release-el{{ ansible_distribution_major_version }}-1.noarch.rpm' + state: present become: yes become_user: root diff --git a/playbooks/develop/debian.yml b/playbooks/develop/debian.yml index 1d3e42c0..90d95083 100755 --- a/playbooks/develop/debian.yml +++ b/playbooks/develop/debian.yml @@ -49,10 +49,13 @@ - libwebp-dev - python-tk + # Ensure apt-transport-https + - apt-transport-https + become: yes become_user: root - - name: install pillow prerequisites for Debian < 8 + - name: install pillow prerequisites for Debian < 8 apt: pkg={{ item }} state=present with_items: - libjpeg8-dev @@ -74,16 +77,19 @@ become: yes become_user: root - - name: Get nodejs 6.x bash script - get_url: - url: 'https://deb.nodesource.com/setup_6.x' - dest: '/tmp/setup_6.x' - mode: 0644 + - name: Add apt key for node repo + apt_key: + url: https://keyserver.ubuntu.com/pks/lookup?op=get&fingerprint=on&search=0x1655A0AB68576280 + id: "68576280" + state: present become: yes become_user: root - - name: Run nodejs bash script - command: /bin/bash /tmp/setup_6.x + - name: Add repo + apt_repository: + repo: "deb [arch=amd64,i386] https://deb.nodesource.com/node_6.x {{ ansible_distribution_release }} main" + state: present + update_cache: yes become: yes become_user: root @@ -95,7 +101,7 @@ force: yes become: yes become_user: root - + # install MariaDB - include: includes/mariadb_debian.yml diff --git a/playbooks/develop/ubuntu.yml b/playbooks/develop/ubuntu.yml index 4379d1e4..f25af6e7 100644 --- a/playbooks/develop/ubuntu.yml +++ b/playbooks/develop/ubuntu.yml @@ -34,6 +34,9 @@ - libwebp-dev - python-tk + # Ensure apt-transport-https + - apt-transport-https + become: yes become_user: root @@ -57,16 +60,19 @@ become: yes become_user: root - - name: Get nodejs 6.x bash script - get_url: - url: 'https://deb.nodesource.com/setup_6.x' - dest: '/tmp/setup_6.x' - mode: 0644 + - name: Add apt key for node repo + apt_key: + url: https://keyserver.ubuntu.com/pks/lookup?op=get&fingerprint=on&search=0x1655A0AB68576280 + id: "68576280" + state: present become: yes become_user: root - - name: Run nodejs bash script - command: /bin/bash /tmp/setup_6.x + - name: Add repo + apt_repository: + repo: "deb [arch=amd64,i386] https://deb.nodesource.com/node_6.x {{ ansible_distribution_release }} main" + state: present + register: node_repo become: yes become_user: root