diff --git a/anvil/components/horizon.py b/anvil/components/horizon.py index a322251a..61be1355 100644 --- a/anvil/components/horizon.py +++ b/anvil/components/horizon.py @@ -72,42 +72,6 @@ class HorizonInstaller(comp.PythonInstallComponent): comp.PythonInstallComponent.verify(self) self._check_ug() - def pre_install(self): - self._install_node_repo() - - def _install_node_repo(self): - repo_url = self.get_option('nodejs_repo') - if not repo_url: - # Ok then, hope node js is in your path for when horizon attempts - # to use it... if not possibly follow: - # - # http://www.chrisabernethy.com/installing-node-js-on-centos-redhat/ - return - # Download the said url and install it so that we can actually install - # the node.js requirement which seems to be needed by horizon for css compiling?? - repo_basename = sh.basename(repo_url) - (_fn, fn_ext) = os.path.splitext(repo_basename) - fn_ext = fn_ext.lower().strip() - if fn_ext not in ['.rpm', '.repo']: - LOG.warn("Unknown node.js repository configuration extension %s (we only support .rpm or .repo)!", colorizer.quote(fn_ext)) - return - with NamedTemporaryFile(suffix=fn_ext) as temp_fh: - LOG.info("Downloading node.js repository configuration from %s to %s.", repo_url, temp_fh.name) - down.UrlLibDownloader(repo_url, temp_fh.name).download() - temp_fh.flush() - if fn_ext == ".repo": - # Just write out the repo file after downloading it... - repo_file_name = sh.joinpths("/etc/yum.repos.d", repo_basename) - if not sh.exists(repo_file_name): - with sh.Rooted(True): - sh.write_file(repo_file_name, sh.load_file(temp_fh.name), - tracewriter=self.tracewriter) - sh.chmod(repo_file_name, 0644) - elif fn_ext == ".rpm": - # Install it instead from said rpm (which likely is a - # file that contains said repo location)... - yum.YumPackager(self.distro).direct_install(temp_fh.name) - @property def symlinks(self): links = super(HorizonInstaller, self).symlinks diff --git a/conf/components/horizon.yaml b/conf/components/horizon.yaml index e84dd2ba..b0630173 100644 --- a/conf/components/horizon.yaml +++ b/conf/components/horizon.yaml @@ -17,13 +17,6 @@ apache_user: "$(auto:user)" # Port horizon should run on port: 80 -# We need to get a viable node.js repository to work -# with, this is only really needed for distributions where -# said distributions do not have node.js available yet... -# -# NOTE(harlowja): blank out/remove as needed... -nodejs_repo: "http://nodejs.tchol.org/repocfg/el/nodejs-stable-release.noarch.rpm" - # Needed for setting up your database db: type: "$(db:type)" diff --git a/conf/distros/rhel.yaml b/conf/distros/rhel.yaml index 9af4fb8c..bd694566 100644 --- a/conf/distros/rhel.yaml +++ b/conf/distros/rhel.yaml @@ -259,9 +259,7 @@ components: packages: - name: httpd - name: mod_wsgi - - name: nodejs - - name: nodejs-compat-symlinks - - name: npm + - name: ./local-rpms/nodejs-0.10.0-1.x86_64.rpm pips: - name: django-openstack-auth - name: nosexcover diff --git a/local-rpms/nodejs-0.10.0-1.x86_64.rpm b/local-rpms/nodejs-0.10.0-1.x86_64.rpm new file mode 100644 index 00000000..136f0b38 Binary files /dev/null and b/local-rpms/nodejs-0.10.0-1.x86_64.rpm differ diff --git a/tools/build-install-node-from-source.sh b/tools/build-install-node-from-source.sh new file mode 100755 index 00000000..fbcb52a7 --- /dev/null +++ b/tools/build-install-node-from-source.sh @@ -0,0 +1,57 @@ +#!/bin/bash +set -x + +nodejs_dir="`pwd`/.nodejs-build-dir" +mkdir $nodejs_dir +cd $nodejs_dir + +echo "Downloading http://nodejs.org/dist/node-latest.tar.gz" +wget "http://nodejs.org/dist/node-latest.tar.gz" +tar -xzf node-latest.tar.gz + +VERSION=`ls $nodejs_dir/ | grep node-v | cut -d 'v' -f2` +echo $VERSION + +cd node-v$VERSION* +export CFLAGS=" -w -pipe -O3" +export CXXFLAGS=" -w -pipe -O3" +./configure --prefix=/usr + +echo +echo "Building Node ..." +make + +echo +echo "Installing into $nodejs_dir/install-root ..." +mkdir -p "$nodejs_dir/install-root" +make install DESTDIR="$nodejs_dir/install-root" + +cd $nodejs_dir +echo +echo "Building RPM ..." +mkdir -p "$nodejs_dir/RPMS" + +RELEASE=1 +echo "Name: nodejs + +Version: $VERSION +Release: $RELEASE +Summary: Server Side JavaScript Engine +URL: http://nodejs.org +Group: Development/Languages +License: MIT and BSD +Requires: openssl, zlib, glibc + +%description +Node.js is Google V8 JavaScript with an evented I/O based interface to POSIX. This RPM was built using https://github.com/ddopson/nodejs-rpm-builder +as a reference + +%files +%defattr(-,root,root,-) +/" > package.spec + +rpmbuild -bb package.spec --buildroot "$nodejs_dir/install-root" --define "_topdir $nodejs_dir" --define "VERSION $VERSION" + +yum install -y -q $nodejs_dir/RPMS/x86_64/nodejs-$VERSION-$RELEASE.x86_64.rpm + +rm -rf $nodejs_dir