diff --git a/README.md b/README.md index e17367f..cfc4c83 100644 --- a/README.md +++ b/README.md @@ -53,12 +53,18 @@ Installation We're still in a stage where the installation generally requires many manual steps. -``bash +```bash curl https://git.daplie.com/Daplie/walnut.js/raw/v1.2/installer/get.sh | bash ``` See [INSTALL.md](/INSTALL.md) +### Uninstall + +```bash +rm -rf /srv/walnut/ /var/walnut/ /etc/walnut/ /opt/walnut/ /var/log/walnut/ /etc/systemd/system/walnut.service /etc/tmpfiles.d/walnut.conf +``` + Usage ----- @@ -98,6 +104,7 @@ Understanding Walnut │ ├── rest │ └── services └── var + ├── <>/config.json └── sites ``` @@ -273,7 +280,7 @@ The packages: The permissions: ``` -/srv/walnut/packages/ +/srv/walnut/etc/ └── client-api-grants └── cloud.foobar.me ''' diff --git a/dist/var/example.com/config.json b/dist/var/example.com/config.json new file mode 100644 index 0000000..b89be1e --- /dev/null +++ b/dist/var/example.com/config.json @@ -0,0 +1,11 @@ +{ "mailgun.org": { + "apiKey": "key-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + , "apiPublicKey": "pubkey-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + , "auth": { + "user": "mailer@example.com" + , "pass": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + , "api_key": "key-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + , "domain": "example.com" + } + } +} diff --git a/installer/install.sh b/installer/install.sh index f618fa5..0b5db33 100644 --- a/installer/install.sh +++ b/installer/install.sh @@ -9,6 +9,8 @@ my_name=walnut my_app_pkg_name=com.daplie.walnut.web my_app_ver="v1.2" my_azp_oauth3_ver="v1.2" +# is the old version still needed in launchpad? +#my_azp_oauth3_ver="v1.1.3" export NODE_VERSION="v8.9.0" if [ -z "${my_tmp-}" ]; then @@ -24,25 +26,24 @@ fi ### IMPORTANT ### ### VERSION ### #my_app_ver="v1.1" -my_app_ver="installer-v2" +my_app_ver="v1.2" my_launchpad_ver="v1.2" -my_azp_oauth3_ver="v1.1.3" my_iss_oauth3_rest_ver="v1.2.0" my_iss_oauth3_pages_ver="v1.2.1" my_www_daplie_ver=v1.0.15 export NODE_VERSION="v8.9.0" ################# -export NODE_PATH=$my_tmp/opt/$my_app_name/lib/node_modules -export PATH=$my_tmp/opt/$my_app_name/bin/:$PATH -export NPM_CONFIG_PREFIX=$my_tmp/opt/$my_app_name +export NODE_PATH=$my_tmp/opt/$my_name/lib/node_modules +export PATH=$my_tmp/opt/$my_name/bin/:$PATH +export NPM_CONFIG_PREFIX=$my_tmp/opt/$my_name my_npm="$NPM_CONFIG_PREFIX/bin/npm" ################# # TODO un-hardcode core at al -#my_app_dist=$my_tmp/opt/$my_app_name/lib/node_modules/$my_app_name/dist -my_app_dist=$my_tmp/opt/$my_app_name/core/dist +#my_app_dist=$my_tmp/opt/$my_name/lib/node_modules/$my_name/dist +my_app_dist=$my_tmp/opt/$my_name/core/dist installer_base="https://git.daplie.com/Daplie/goldilocks.js/raw/$my_app_ver" # Backwards compat @@ -54,24 +55,24 @@ my_app_name=$my_name git checkout $my_app_ver -mkdir -p $my_tmp/{etc,opt,srv,var}/$my_app_name -mkdir -p "$my_tmp/var/log/$my_app_name" -mkdir -p "$my_tmp/opt/$my_app_name"/{bin,config,core,etc,lib,node_modules,var} -ln -s ../core/bin/$my_app_name.js $my_tmp/opt/$my_app_name/bin/$my_app_name -ln -s ../core/bin/$my_app_name.js $my_tmp/opt/$my_app_name/bin/$my_app_name.js -#ln -s ../lib/node_modules/$my_app_name/bin/$my_app_name.js $my_tmp/opt/$my_app_name/bin/$my_app_name -#ln -s ../lib/node_modules/$my_app_name/bin/$my_app_name.js $my_tmp/opt/$my_app_name/bin/$my_app_name.js -mkdir -p "$my_tmp/opt/$my_app_name"/packages/{api,pages,rest,services} -mkdir -p "$my_tmp/opt/$my_app_name"/etc/client-api-grants +mkdir -p $my_tmp/{etc,opt,srv,var}/$my_name +mkdir -p "$my_tmp/var/log/$my_name" +mkdir -p "$my_tmp/opt/$my_name"/{bin,config,core,etc,lib,node_modules,var} +ln -s ../core/bin/$my_name.js $my_tmp/opt/$my_name/bin/$my_name +ln -s ../core/bin/$my_name.js $my_tmp/opt/$my_name/bin/$my_name.js +#ln -s ../lib/node_modules/$my_name/bin/$my_name.js $my_tmp/opt/$my_name/bin/$my_name +#ln -s ../lib/node_modules/$my_name/bin/$my_name.js $my_tmp/opt/$my_name/bin/$my_name.js +mkdir -p "$my_tmp/opt/$my_name"/packages/{api,pages,rest,services} +mkdir -p "$my_tmp/opt/$my_name"/etc/client-api-grants # TODO move packages and sites to /srv, grants to /etc -ln -s ../etc/client-api-grants "$my_tmp/opt/$my_app_name"/packages/client-api-grants -mkdir -p "$my_tmp/opt/$my_app_name"/var/sites -ln -s ../var/sites "$my_tmp/opt/$my_app_name"/packages/sites -mkdir -p "$my_tmp/etc/$my_app_name" -chmod 775 "$my_tmp/etc/$my_app_name" -cat "$my_app_dist/etc/$my_app_name/$my_app_name.example.yml" > "$my_tmp/etc/$my_app_name/$my_app_name.example.yml" -chmod 664 "$my_tmp/etc/$my_app_name/$my_app_name.example.yml" -mkdir -p $my_tmp/var/log/$my_app_name +ln -s ../etc/client-api-grants "$my_tmp/opt/$my_name"/packages/client-api-grants +mkdir -p "$my_tmp/opt/$my_name"/var/sites +ln -s ../var/sites "$my_tmp/opt/$my_name"/packages/sites +mkdir -p "$my_tmp/etc/$my_name" +chmod 775 "$my_tmp/etc/$my_name" +cat "$my_app_dist/etc/$my_name/$my_name.example.yml" > "$my_tmp/etc/$my_name/$my_name.example.yml" +chmod 664 "$my_tmp/etc/$my_name/$my_name.example.yml" +mkdir -p $my_tmp/var/log/$my_name @@ -91,35 +92,35 @@ echo $NODE_VERSION > /tmp/NODEJS_VER http_bash "https://git.coolaj86.com/coolaj86/node-installer.sh/raw/v1.1/install.sh" $my_npm install -g npm@4 $my_npm install -g bower -touch $my_tmp/opt/$my_app_name/.bowerrc -echo '{ "allow_root": true }' > $my_tmp/opt/$my_app_name/.bowerrc +touch $my_tmp/opt/$my_name/.bowerrc +echo '{ "allow_root": true }' > $my_tmp/opt/$my_name/.bowerrc -#pushd $my_tmp/opt/$my_app_name/lib/node_modules/$my_app_name -pushd $my_tmp/opt/$my_app_name/core +#pushd $my_tmp/opt/$my_name/lib/node_modules/$my_name +pushd $my_tmp/opt/$my_name/core mkdir -p ../node_modules ln -s ../node_modules node_modules $my_npm install popd -git clone https://git.daplie.com/Daplie/walnut_launchpad.git $my_tmp/opt/$my_app_name/core/lib/walnut@daplie.com/setup -pushd $my_tmp/opt/$my_app_name/core/lib/walnut@daplie.com/setup +git clone https://git.daplie.com/Daplie/walnut_launchpad.git $my_tmp/opt/$my_name/core/lib/walnut@daplie.com/setup +pushd $my_tmp/opt/$my_name/core/lib/walnut@daplie.com/setup git pull git checkout $my_launchpad_ver - git clone https://git.daplie.com/OAuth3/oauth3.js.git ./assets/oauth3.org + git clone https://git.oauth3.org/OAuth3/oauth3.js.git ./assets/oauth3.org pushd assets/oauth3.org git checkout $my_azp_oauth3_ver popd popd -pushd $my_tmp/opt/$my_app_name/packages - git clone https://git.daplie.com/OAuth3/issuer_oauth3.org.git rest/issuer@oauth3.org +pushd $my_tmp/opt/$my_name/packages + git clone https://git.oauth3.org/OAuth3/issuer.rest.walnut.js.git rest/issuer@oauth3.org pushd rest/issuer@oauth3.org/ git checkout $my_iss_oauth3_rest_ver $my_npm install popd - git clone https://git.daplie.com/OAuth3/org.oauth3.git pages/issuer@oauth3.org + git clone https://git.oauth3.org/OAuth3/issuer.html.git pages/issuer@oauth3.org pushd pages/issuer@oauth3.org git checkout $my_iss_oauth3_pages_ver bash ./install.sh @@ -160,18 +161,18 @@ $sudo_cmd chown root:root $my_tmp/* $sudo_cmd chown root:root $my_tmp $sudo_cmd chmod 0755 $my_tmp $sudo_cmd rsync -a --ignore-existing $my_tmp/ $my_root/ -$sudo_cmd rsync -a --ignore-existing $my_app_dist/etc/$my_app_name/$my_app_name.yml $my_root/etc/$my_app_name/$my_app_name.yml +$sudo_cmd rsync -a --ignore-existing $my_app_dist/etc/$my_name/$my_name.yml $my_root/etc/$my_name/$my_name.yml source ./installer/install-system-service.sh # Change to admin perms -$sudo_cmd chown -R $my_user:$my_group $my_root/opt/$my_app_name +$sudo_cmd chown -R $my_user:$my_group $my_root/opt/$my_name $sudo_cmd chown -R $my_user:$my_group $my_root/var/www $my_root/srv/www # make sure the files are all read/write for the owner and group, and then set # the setuid and setgid bits so that any files/directories created inside these # directories have the same owner and group. -$sudo_cmd chmod -R ug+rwX $my_root/opt/$my_app_name -find $my_root/opt/$my_app_name -type d -exec $sudo_cmd chmod ug+s {} \; +$sudo_cmd chmod -R ug+rwX $my_root/opt/$my_name +find $my_root/opt/$my_name -type d -exec $sudo_cmd chmod ug+s {} \; diff --git a/package.json b/package.json index ab35746..ca68866 100644 --- a/package.json +++ b/package.json @@ -62,7 +62,7 @@ "multiparty": "^4.1.3", "nodemailer": "^1.4.0", "nodemailer-mailgun-transport": "1.x", - "oauth3.js": "git+https://git.daplie.com/OAuth3/oauth3.js.git", + "oauth3.js": "git+https://git.oauth3.org/OAuth3/oauth3.js.git#v1.2", "recase": "^1.0.4", "request": "^2.81.0", "scmp": "^2.0.0",