Page MenuHomeDevCentral

D375.diff
No OneTemporary

D375.diff

diff --git a/.arcconfig b/.arcconfig
new file mode 100644
--- /dev/null
+++ b/.arcconfig
@@ -0,0 +1,4 @@
+{
+ "repository.callsign": "DGROVE",
+ "phabricator.uri": "https://devcentral.nasqueron.org"
+}
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,29 @@
+#
+# Nasqueron - Auth Grove image
+#
+
+FROM nasqueron/nginx-php-fpm:novolume
+MAINTAINER Nasqueron Organisation <docker@nasqueron.org>
+
+#
+# Prepare the container
+#
+
+COPY files /
+
+WORKDIR /var/wwwroot/default
+
+RUN setup-nodesource-deb && apt-get install -y nodejs && \
+ apt-get clean && rm -rf /var/lib/apt/lists/* && \
+ git init && git remote add origin https://github.com/nasqueron/auth-grove.git && \
+ git fetch && git checkout -t origin/master && \
+ composer install --no-dev -o && \
+ npm install -g gulp && \
+ npm install && \
+ chown -R app:app /var/wwwroot/default
+
+#
+# Run the container
+#
+
+CMD ["/usr/local/sbin/init-container"]
diff --git a/Makefile b/Makefile
new file mode 100644
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,9 @@
+all: setup-nodesource-deb
+
+setup-nodesource-deb:
+ wget -O setup-nodesource-deb https://raw.githubusercontent.com/nodesource/distributions/master/deb/setup_6.x
+ chmod +x setup-nodesource-deb
+
+clean:
+ rm -f setup-nodesource-deb
+
diff --git a/files/etc/nginx/sites-available/default b/files/etc/nginx/sites-available/default
new file mode 100644
--- /dev/null
+++ b/files/etc/nginx/sites-available/default
@@ -0,0 +1,22 @@
+server {
+ listen 80 default_server;
+ listen [::]:80 default_server;
+ server_name _;
+
+ root /var/wwwroot/default/public;
+
+ index index.php index.html index.htm;
+
+ location / {
+ try_files $uri /index.php$is_args$args;
+ }
+
+ location ~ \.php$ {
+ include snippets/fastcgi-php.conf;
+ fastcgi_pass 127.0.0.1:9000;
+ }
+
+ location ~ /\.ht {
+ deny all;
+ }
+}
diff --git a/files/usr/local/bin/setup-container b/files/usr/local/bin/setup-container
new file mode 100755
--- /dev/null
+++ b/files/usr/local/bin/setup-container
@@ -0,0 +1,40 @@
+#!/usr/bin/env bash
+
+pushd /var/wwwroot/default
+
+# Generates a unique application key in .env
+function generate_key {
+ KEY=`php artisan key:generate --show`
+ if [ -f .env ]; then
+ echo "" >> .env
+ fi
+ echo "APP_KEY=$KEY" >> .env
+}
+
+# Determines if APP_KEY is missing
+function is_app_key_missing {
+ if [ -v APP_KEY ]; then
+ return 0
+ fi
+
+ if [ ! -f .env ]; then
+ return 1
+ fi
+
+ grep -q 'APP_KEY=' .env
+ return $?
+}
+
+if [ -z "$NO_INSTALL" ]; then
+ is_app_key_missing
+ if [ $? -eq 1 ]; then
+ generate_key
+ fi
+ php artisan config:cache
+ php artisan migrate --force
+ gulp --production
+fi
+
+# We're done
+popd
+touch .initialized
diff --git a/files/usr/local/sbin/init-container b/files/usr/local/sbin/init-container
new file mode 100755
--- /dev/null
+++ b/files/usr/local/sbin/init-container
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+if [ ! -f .initialized ]; then
+ # Container is initialized according the environment variables
+ # passed to the container to setup the application.
+ /usr/local/bin/setup-container
+fi
+
+/usr/local/sbin/runsvdir-init
diff --git a/files/usr/local/sbin/setup-nodesource-deb b/files/usr/local/sbin/setup-nodesource-deb
new file mode 100755
--- /dev/null
+++ b/files/usr/local/sbin/setup-nodesource-deb
@@ -0,0 +1,147 @@
+#!/bin/bash
+
+# Discussion, issues and change requests at:
+# https://github.com/nodesource/distributions
+#
+# Script to install the NodeSource Node.js v6.x repo onto a
+# Debian or Ubuntu system.
+#
+# Run as root or insert `sudo -E` before `bash`:
+#
+# curl -sL https://deb.nodesource.com/setup_6.x | bash -
+# or
+# wget -qO- https://deb.nodesource.com/setup_6.x | bash -
+#
+
+export DEBIAN_FRONTEND=noninteractive
+
+print_status() {
+ echo
+ echo "## $1"
+ echo
+}
+
+bail() {
+ echo 'Error executing command, exiting'
+ exit 1
+}
+
+exec_cmd_nobail() {
+ echo "+ $1"
+ bash -c "$1"
+}
+
+exec_cmd() {
+ exec_cmd_nobail "$1" || bail
+}
+
+
+print_status "Installing the NodeSource Node.js v6.x repo..."
+
+
+PRE_INSTALL_PKGS=""
+
+# Check that HTTPS transport is available to APT
+# (Check snaked from: https://get.docker.io/ubuntu/)
+
+if [ ! -e /usr/lib/apt/methods/https ]; then
+ PRE_INSTALL_PKGS="${PRE_INSTALL_PKGS} apt-transport-https"
+fi
+
+if [ ! -x /usr/bin/lsb_release ]; then
+ PRE_INSTALL_PKGS="${PRE_INSTALL_PKGS} lsb-release"
+fi
+
+if [ ! -x /usr/bin/curl ] && [ ! -x /usr/bin/wget ]; then
+ PRE_INSTALL_PKGS="${PRE_INSTALL_PKGS} curl"
+fi
+
+# Populating Cache
+print_status "Populating apt-get cache..."
+exec_cmd 'apt-get update'
+
+if [ "X${PRE_INSTALL_PKGS}" != "X" ]; then
+ print_status "Installing packages required for setup:${PRE_INSTALL_PKGS}..."
+ # This next command needs to be redirected to /dev/null or the script will bork
+ # in some environments
+ exec_cmd "apt-get install -y${PRE_INSTALL_PKGS} > /dev/null 2>&1"
+fi
+
+DISTRO=$(lsb_release -c -s)
+
+check_alt() {
+ if [ "X${DISTRO}" == "X${2}" ]; then
+ echo
+ echo "## You seem to be using ${1} version ${DISTRO}."
+ echo "## This maps to ${3} \"${4}\"... Adjusting for you..."
+ DISTRO="${4}"
+ fi
+}
+
+check_alt "Kali" "sana" "Debian" "jessie"
+check_alt "Debian" "stretch" "Debian" "jessie"
+check_alt "Linux Mint" "maya" "Ubuntu" "precise"
+check_alt "Linux Mint" "qiana" "Ubuntu" "trusty"
+check_alt "Linux Mint" "rafaela" "Ubuntu" "trusty"
+check_alt "Linux Mint" "rebecca" "Ubuntu" "trusty"
+check_alt "Linux Mint" "rosa" "Ubuntu" "trusty"
+check_alt "LMDE" "betsy" "Debian" "jessie"
+check_alt "elementaryOS" "luna" "Ubuntu" "precise"
+check_alt "elementaryOS" "freya" "Ubuntu" "trusty"
+check_alt "Trisquel" "toutatis" "Ubuntu" "precise"
+check_alt "Trisquel" "belenos" "Ubuntu" "trusty"
+check_alt "BOSS" "anokha" "Debian" "wheezy"
+check_alt "bunsenlabs" "bunsen-hydrogen" "Debian" "jessie"
+check_alt "Tanglu" "chromodoris" "Debian" "jessie"
+
+if [ "X${DISTRO}" == "Xdebian" ]; then
+ print_status "Unknown Debian-based distribution, checking /etc/debian_version..."
+ NEWDISTRO=$([ -e /etc/debian_version ] && cut -d/ -f1 < /etc/debian_version)
+ if [ "X${NEWDISTRO}" == "X" ]; then
+ print_status "Could not determine distribution from /etc/debian_version..."
+ else
+ DISTRO=$NEWDISTRO
+ print_status "Found \"${DISTRO}\" in /etc/debian_version..."
+ fi
+fi
+
+print_status "Confirming \"${DISTRO}\" is supported..."
+
+if [ -x /usr/bin/curl ]; then
+ exec_cmd_nobail "curl -sLf -o /dev/null 'https://deb.nodesource.com/node_6.x/dists/${DISTRO}/Release'"
+ RC=$?
+else
+ exec_cmd_nobail "wget -qO /dev/null -o /dev/null 'https://deb.nodesource.com/node_6.x/dists/${DISTRO}/Release'"
+ RC=$?
+fi
+
+if [[ $RC != 0 ]]; then
+ print_status "Your distribution, identified as \"${DISTRO}\", is not currently supported, please contact NodeSource at https://github.com/nodesource/distributions/issues if you think this is incorrect or would like your distribution to be considered for support"
+ exit 1
+fi
+
+if [ -f "/etc/apt/sources.list.d/chris-lea-node_js-$DISTRO.list" ]; then
+ print_status 'Removing Launchpad PPA Repository for NodeJS...'
+
+ exec_cmd_nobail 'add-apt-repository -y -r ppa:chris-lea/node.js'
+ exec_cmd "rm -f /etc/apt/sources.list.d/chris-lea-node_js-${DISTRO}.list"
+fi
+
+print_status 'Adding the NodeSource signing key to your keyring...'
+
+if [ -x /usr/bin/curl ]; then
+ exec_cmd 'curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add -'
+else
+ exec_cmd 'wget -qO- https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add -'
+fi
+
+print_status 'Creating apt sources list file for the NodeSource Node.js v6.x repo...'
+
+exec_cmd "echo 'deb https://deb.nodesource.com/node_6.x ${DISTRO} main' > /etc/apt/sources.list.d/nodesource.list"
+exec_cmd "echo 'deb-src https://deb.nodesource.com/node_6.x ${DISTRO} main' >> /etc/apt/sources.list.d/nodesource.list"
+
+print_status 'Running `apt-get update` for you...'
+
+exec_cmd 'apt-get update'
+
+print_status 'Run `apt-get install nodejs` (as root) to install Node.js v6.x and npm'

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 17, 08:25 (21 h, 33 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2248964
Default Alt Text
D375.diff (8 KB)

Event Timeline