Merge branch 'fs-nosql' of git.daplie.com:Daplie/walnut.js into fs-nosql
This commit is contained in:
		
						commit
						db32e76fc2
					
				
							
								
								
									
										23
									
								
								install.sh
									
									
									
									
									
								
							
							
						
						
									
										23
									
								
								install.sh
									
									
									
									
									
								
							@ -72,8 +72,8 @@ dap_dl_bash()
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
  dap_url=$1
 | 
					  dap_url=$1
 | 
				
			||||||
  #dap_args=$2
 | 
					  #dap_args=$2
 | 
				
			||||||
  rm -rf dap-tmp-runner.sh
 | 
					  rm -rf /tmp/dap-tmp-runner.sh
 | 
				
			||||||
  $http_bin $http_opts $http_out dap-tmp-runner.sh "$dap_url"; bash dap-tmp-runner.sh; rm dap-tmp-runner.sh
 | 
					  $http_bin $http_opts $http_out /tmp/dap-tmp-runner.sh "$dap_url"; bash /tmp/dap-tmp-runner.sh; rm /tmp/dap-tmp-runner.sh
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
detect_http_bin
 | 
					detect_http_bin
 | 
				
			||||||
@ -134,6 +134,7 @@ install_for_launchd()
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
install_etc_config()
 | 
					install_etc_config()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					  #echo "install etc config $MY_ROOT / $my_app_etc_config"
 | 
				
			||||||
  if [ ! -e "$MY_ROOT/$my_app_etc_config" ]; then
 | 
					  if [ ! -e "$MY_ROOT/$my_app_etc_config" ]; then
 | 
				
			||||||
    $sudo_cmd mkdir -p $(dirname "$MY_ROOT/$my_app_etc_config")
 | 
					    $sudo_cmd mkdir -p $(dirname "$MY_ROOT/$my_app_etc_config")
 | 
				
			||||||
    mkdir -p $(dirname "$my_app_dir/$my_app_etc_config")
 | 
					    mkdir -p $(dirname "$my_app_dir/$my_app_etc_config")
 | 
				
			||||||
@ -141,7 +142,8 @@ install_etc_config()
 | 
				
			|||||||
    $sudo_cmd mv "$my_app_dir/$my_app_etc_config" "$MY_ROOT/$my_app_etc_config"
 | 
					    $sudo_cmd mv "$my_app_dir/$my_app_etc_config" "$MY_ROOT/$my_app_etc_config"
 | 
				
			||||||
  fi
 | 
					  fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  $sudo_cmd chown -R www-data:www-data $(dirname "$MY_ROOT/$my_app_etc_config")
 | 
					  $sudo_cmd chown -R www-data:www-data $(dirname "$MY_ROOT/$my_app_etc_config") || true
 | 
				
			||||||
 | 
					  $sudo_cmd chown -R _www:_www $(dirname "$MY_ROOT/$my_app_etc_config") || true
 | 
				
			||||||
  $sudo_cmd chmod 775 $(dirname "$MY_ROOT/$my_app_etc_config")
 | 
					  $sudo_cmd chmod 775 $(dirname "$MY_ROOT/$my_app_etc_config")
 | 
				
			||||||
  $sudo_cmd chmod 664 "$MY_ROOT/$my_app_etc_config"
 | 
					  $sudo_cmd chmod 664 "$MY_ROOT/$my_app_etc_config"
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -149,6 +151,7 @@ install_etc_config()
 | 
				
			|||||||
install_service()
 | 
					install_service()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  install_etc_config
 | 
					  install_etc_config
 | 
				
			||||||
 | 
					  #echo "install service"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  installable=""
 | 
					  installable=""
 | 
				
			||||||
  if [ -d "$MY_ROOT/etc/systemd/system" ]; then
 | 
					  if [ -d "$MY_ROOT/etc/systemd/system" ]; then
 | 
				
			||||||
@ -184,6 +187,7 @@ create_skeleton()
 | 
				
			|||||||
# Unistall
 | 
					# Unistall
 | 
				
			||||||
install_uninstaller()
 | 
					install_uninstaller()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					  #echo "install uninstaller"
 | 
				
			||||||
  dap_dl "https://git.daplie.com/Daplie/walnut.js/raw/master/uninstall.sh" "./walnut-uninstall"
 | 
					  dap_dl "https://git.daplie.com/Daplie/walnut.js/raw/master/uninstall.sh" "./walnut-uninstall"
 | 
				
			||||||
  $sudo_cmd chmod 755 "./walnut-uninstall"
 | 
					  $sudo_cmd chmod 755 "./walnut-uninstall"
 | 
				
			||||||
  $sudo_cmd chown root:root "./walnut-uninstall"
 | 
					  $sudo_cmd chown root:root "./walnut-uninstall"
 | 
				
			||||||
@ -201,7 +205,8 @@ my_app_name=walnut
 | 
				
			|||||||
my_app_pkg_name=com.daplie.walnut.web
 | 
					my_app_pkg_name=com.daplie.walnut.web
 | 
				
			||||||
my_app_dir=$(mktemp -d)
 | 
					my_app_dir=$(mktemp -d)
 | 
				
			||||||
#installer_base="https://git.daplie.com/Daplie/walnut.js/raw/master/dist"
 | 
					#installer_base="https://git.daplie.com/Daplie/walnut.js/raw/master/dist"
 | 
				
			||||||
installer_base="./dist"
 | 
					#installer_base="$( dirname "${BASH_SOURCE[0]}" )/dist"
 | 
				
			||||||
 | 
					installer_base="/srv/walnut/core/dist"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
my_app_etc_config="etc/${my_app_name}/${my_app_name}.yml"
 | 
					my_app_etc_config="etc/${my_app_name}/${my_app_name}.yml"
 | 
				
			||||||
my_app_systemd_service="etc/systemd/system/${my_app_name}.service"
 | 
					my_app_systemd_service="etc/systemd/system/${my_app_name}.service"
 | 
				
			||||||
@ -219,16 +224,20 @@ install_my_app()
 | 
				
			|||||||
  sudo mkdir -p /srv/walnut/etc/org.oauth3.consumer
 | 
					  sudo mkdir -p /srv/walnut/etc/org.oauth3.consumer
 | 
				
			||||||
  sudo mkdir -p /srv/walnut/etc/org.oauth3.provider
 | 
					  sudo mkdir -p /srv/walnut/etc/org.oauth3.provider
 | 
				
			||||||
  sudo mkdir -p /srv/walnut/packages/{client-api-grants,rest,api,pages,services,sites}
 | 
					  sudo mkdir -p /srv/walnut/packages/{client-api-grants,rest,api,pages,services,sites}
 | 
				
			||||||
  #sudo chown -R $(whoami):$(whoami) /srv/walnut
 | 
					 | 
				
			||||||
  sudo chown -R www-data:www-data /srv/walnut
 | 
					 | 
				
			||||||
  sudo chmod -R ug+Xrw /srv/walnut
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  pushd /srv/walnut/core
 | 
					  pushd /srv/walnut/core
 | 
				
			||||||
    npm install
 | 
					    npm install
 | 
				
			||||||
  popd
 | 
					  popd
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					sudo mkdir -p /srv/walnut
 | 
				
			||||||
 | 
					sudo chown -R $(whoami) /srv/walnut
 | 
				
			||||||
 | 
					
 | 
				
			||||||
install_my_app
 | 
					install_my_app
 | 
				
			||||||
create_skeleton
 | 
					create_skeleton
 | 
				
			||||||
install_uninstaller
 | 
					install_uninstaller
 | 
				
			||||||
install_service
 | 
					install_service
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					sudo chown -R www-data:www-data /srv/walnut || true
 | 
				
			||||||
 | 
					sudo chown -R _www:_www /srv/walnut || true
 | 
				
			||||||
 | 
					sudo chmod -R ug+Xrw /srv/walnut
 | 
				
			||||||
 | 
				
			|||||||
@ -36,6 +36,23 @@
 | 
				
			|||||||
    <!-- END TRACKJS -->
 | 
					    <!-- END TRACKJS -->
 | 
				
			||||||
  </head>
 | 
					  </head>
 | 
				
			||||||
  <body class="aj-pad-top fade" ng-class="{ in: R.ready }">
 | 
					  <body class="aj-pad-top fade" ng-class="{ in: R.ready }">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<pre><code>HTML packages go in /srv/walnut/packages/pages
 | 
				
			||||||
 | 
					REST packages go in /srv/walnut/packages/rest
 | 
				
			||||||
 | 
					API packages go in /srv/walnut/packages/api
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					There are two ways to set up a site.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					The first is to create a site package yourself by adding files.
 | 
				
			||||||
 | 
					/srv/walnut/packages/sites/example.com/index.html
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					The other is by providing a single text file of the name of the site with the name of the package to load
 | 
				
			||||||
 | 
					/srv/walnut/packages/sites/example.com => com.example</code></pre>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <!--[if lt IE 10]>
 | 
					    <!--[if lt IE 10]>
 | 
				
			||||||
      <p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
 | 
					      <p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
 | 
				
			||||||
    <![endif]-->
 | 
					    <![endif]-->
 | 
				
			||||||
 | 
				
			|||||||
@ -51,7 +51,7 @@ module.exports.create = function (app, xconfx, apiFactories, apiDeps, errorIfApi
 | 
				
			|||||||
  function notConfigured(req, res, next) {
 | 
					  function notConfigured(req, res, next) {
 | 
				
			||||||
    if (setupDomain !== req.hostname) {
 | 
					    if (setupDomain !== req.hostname) {
 | 
				
			||||||
      console.log('[notConfigured] req.hostname', req.hostname);
 | 
					      console.log('[notConfigured] req.hostname', req.hostname);
 | 
				
			||||||
      if (/\.html\b/.test(req.url)) {
 | 
					      if ('/' === req.url[req.url.length - 1] || /\.html\b/.test(req.url)) {
 | 
				
			||||||
        redirectSetup(req.hostname, req, res);
 | 
					        redirectSetup(req.hostname, req, res);
 | 
				
			||||||
        return;
 | 
					        return;
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
@ -59,7 +59,7 @@ module.exports.create = function (app, xconfx, apiFactories, apiDeps, errorIfApi
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    if (!setupApp) {
 | 
					    if (!setupApp) {
 | 
				
			||||||
      //setupApp = express.static(path.join(xconfx.staticpath, 'com.daplie.walnut'));
 | 
					      //setupApp = express.static(path.join(xconfx.staticpath, 'com.daplie.walnut'));
 | 
				
			||||||
      setupApp = express.static(path.join('lib', 'com.daplie.walnut'));
 | 
					      setupApp = express.static(path.join(__dirname, 'com.daplie.walnut'));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    setupApp(req, res, function () {
 | 
					    setupApp(req, res, function () {
 | 
				
			||||||
      if ('/' === req.url) {
 | 
					      if ('/' === req.url) {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user