scope node, npm, and module installs to /opt/goldilocks

This commit is contained in:
AJ ONeal 2017-05-15 23:34:30 -05:00
parent 8599d383df
commit b229bbc6cb
4 changed files with 19 additions and 14 deletions

View File

@ -6,8 +6,8 @@
<string>Goldilocks</string> <string>Goldilocks</string>
<key>ProgramArguments</key> <key>ProgramArguments</key>
<array> <array>
<string>/usr/local/bin/node</string> <string>/opt/goldilocks/bin/node</string>
<string>/usr/local/bin/goldilocks</string> <string>/opt/goldilocks/bin/goldilocks</string>
<string>--config</string> <string>--config</string>
<string>/etc/goldilocks/goldilocks.yml</string> <string>/etc/goldilocks/goldilocks.yml</string>
</array> </array>
@ -15,6 +15,10 @@
<dict> <dict>
<key>GOLDILOCKS_PATH</key> <key>GOLDILOCKS_PATH</key>
<string>/opt/goldilocks</string> <string>/opt/goldilocks</string>
<key>NODE_PATH</key>
<string>/opt/goldilocks/lib/node_modules</string>
<key>NPM_CONFIG_PREFIX</key>
<string>/opt/goldilocks</string>
</dict> </dict>
<key>UserName</key> <key>UserName</key>

View File

@ -23,11 +23,11 @@ User=www-data
Group=www-data Group=www-data
# If we need to pass environment variables in the future # If we need to pass environment variables in the future
Environment=GOLDILOCKS_PATH=/srv/www Environment=GOLDILOCKS_PATH=/srv/www NODE_PATH=/opt/goldilocks/lib/node_modules NPM_CONFIG_PREFIX=/opt/goldilocks
# Set a sane working directory, sane flags, and specify how to reload the config file # Set a sane working directory, sane flags, and specify how to reload the config file
WorkingDirectory=/srv/www WorkingDirectory=/srv/www
ExecStart=/usr/local/bin/node /usr/local/bin/goldilocks --config /etc/goldilocks/goldilocks.yml ExecStart=/opt/goldilocks/bin/node /opt/goldilocks/bin/goldilocks --config /etc/goldilocks/goldilocks.yml
ExecReload=/bin/kill -USR1 $MAINPID ExecReload=/bin/kill -USR1 $MAINPID
# Limit the number of file descriptors and processes; see `man systemd.exec` for more limit settings. # Limit the number of file descriptors and processes; see `man systemd.exec` for more limit settings.

View File

@ -166,6 +166,13 @@ set -u
dap_dl_bash "https://git.daplie.com/coolaj86/node-install-script/raw/master/setup-min.sh" dap_dl_bash "https://git.daplie.com/coolaj86/node-install-script/raw/master/setup-min.sh"
# Install # Install
export NODE_PATH=/opt/goldilocks/lib/node_modules
export NPM_CONFIG_PREFIX=/opt/goldilocks
$sudo_cmd mkdir -p /etc/goldilocks
$sudo_cmd mkdir -p /var/log/goldilocks
$sudo_cmd mkdir -p /srv/www
$sudo_cmd mkdir -p /opt/goldilocks/{lib,bin,etc}
$sudo_cmd chown -R www-data:www-data /srv/www /opt/goldilocks/{lib,bin,etc}
npm install -g 'git+https://git@git.daplie.com/Daplie/goldilocks.js.git#v1' npm install -g 'git+https://git@git.daplie.com/Daplie/goldilocks.js.git#v1'
# Unistall # Unistall
@ -174,11 +181,5 @@ $sudo_cmd chmod 755 "./goldilocks-uninstall"
$sudo_cmd chown root:root "./goldilocks-uninstall" $sudo_cmd chown root:root "./goldilocks-uninstall"
$sudo_cmd mv "./goldilocks-uninstall" "/usr/local/bin/uninstall-goldilocks" $sudo_cmd mv "./goldilocks-uninstall" "/usr/local/bin/uninstall-goldilocks"
# Set perms
$sudo_cmd mkdir -p /srv/www
$sudo_cmd mkdir -p /etc/goldilocks
$sudo_cmd mkdir -p /var/log/goldilocks
$sudo_cmd mkdir -p /opt/goldilocks
# Install Service # Install Service
install_service install_service

View File

@ -26,9 +26,9 @@ my_app_launchd_service="Library/LaunchDaemons/${my_app_pkg_name}.plist"
my_app_upstart_service="etc/init.d/${my_app_name}.conf" my_app_upstart_service="etc/init.d/${my_app_name}.conf"
$sudo_cmd rm -f /usr/local/bin/goldilocks $sudo_cmd rm -f /usr/local/bin/$my_app_name
$sudo_cmd rm -f /usr/local/bin/uninstall-goldilocks $sudo_cmd rm -f /usr/local/bin/uninstall-$my_app_name
$sudo_cmd rm -rf /usr/local/lib/node_modules/goldilocks $sudo_cmd rm -rf /usr/local/lib/node_modules/$my_app_name
$sudo_cmd rm -f "$MY_ROOT/$my_app_etc_config" $sudo_cmd rm -f "$MY_ROOT/$my_app_etc_config"
$sudo_cmd rmdir -p $(dirname "$MY_ROOT/$my_app_etc_config") 2>/dev/null || true $sudo_cmd rmdir -p $(dirname "$MY_ROOT/$my_app_etc_config") 2>/dev/null || true