Update INSTALL.md

This commit is contained in:
AJ ONeal 2017-08-02 15:36:18 -06:00
parent d46e76b073
commit 9c1e2e58d2
1 changed files with 71 additions and 22 deletions

View File

@ -55,19 +55,75 @@ assets.example.com
Basic Walnut Install
--------------------
Follow the [walnut.js README.md](https://git.daplie.com/Daplie/walnut.js/blob/master/README.md)
for instructions to install Goldilocks.js and Walnut.js (and manually setup domains with daplie tools).
```bash
curl https://daplie.me/install-scripts | bash
daplie-install-walnut
```
You could also, of course, try installing from the repository directly
(especially if you have goldilocks or some similar already installed)
```bash
mkdir -p /srv/walnut/
git clone git@git.daplie.com:Daplie/walnut.js.git /srv/walnut/core
pushd /srv/walnut/core
git checkout v1
popd
bash /srv/walnut/core/install-helper.sh
```
Initial Configuration
-------------
Once installed and started you can visit <https://localhost.daplie.me:3000> to configure the primary domain.
You could also do this manually via curl:
```bash
curl -X POST http://api.localhost.daplie.me:3000/api/walnut@daplie.com/init \
-H 'X-Forwarded-Proto: https' \
-H 'Content-Type: application/json' \
-d '{ "domain": "'$my_domain'" }'
```
Reset Permissions
-----------------
Since the app store and package manager are not built yet,
you should also change the permissions on the walnut directory for the purposes of this tutorial:
```bash
sudo chown -R $(whoami) /srv/walnut/
sudo chmod -R +s /srv/walnut/
```
OAuth3 Install
Install OAuth3 API Package
--------------
We need to have a local login system.
For the APIs for that we`ll install the `issuer@oauth3.org` API package and enable it for `api.provider.example.com`:
```
# API packaged for walnut
git clone git@git.daplie.com:OAuth3/org.oauth3.provider.git /srv/walnut/packages/rest/issuer@oauth3.org
pushd /srv/walnut/packages/rest/issuer@oauth3.org/
git checkout v1.2
npm install
popd
# Give permission for this package to provider.example.com
# the api. prefix is omitted because it is always assumed for APIs
echo "issuer@oauth3.org" >> /srv/walnut/packages/client-api-grants/provider.$my_domain
```
*NOTE*: Currently there are some hard-coded values that need to be changed out (TODO use `getSiteConfig()`).
`vim /srv/walnut/packages/rest/issuer@oauth3.org/lib/provide-oauth3.js` and search for the email stuff and change it.
For the user interface for that we'll install the `issuer@oauth3.org` site package and enable it
```
# Frontend
git clone git@git.daplie.com:OAuth3/org.oauth3.git /srv/walnut/packages/pages/issuer@oauth3.org
@ -75,22 +131,8 @@ pushd /srv/walnut/packages/pages/issuer@oauth3.org
bash ./install.sh
popd
# Tell Walnut to load this site package when provider.example.com is requested
echo "issuer@oauth3.org" >> /srv/walnut/var/sites/provider.$my_domain
# APIs
git clone git@git.daplie.com:OAuth3/org.oauth3.provider.git /srv/walnut/packages/rest/issuer@oauth3.org
pushd /srv/walnut/packages/rest/issuer@oauth3.org/
git checkout v1.2
npm install
popd
echo "issuer@oauth3.org" >> /srv/walnut/packages/client-api-grants/provider.$my_domain
```
You also need to change to presently-hardcoded email values (TODO use `getSiteConfig()`)
```
vim /srv/walnut/packages/rest/issuer@oauth3.org/lib/provide-oauth3.js
```
OAuth3 Secrets
@ -101,7 +143,7 @@ It is intended to provide a way to use various mail services in the future,
just bear with us for the time being (or open a Merge Request).
```
vim /srv/walnut/var/example.com/config.json
vim /srv/walnut/var/$my_domain/config.json
```
```
@ -144,11 +186,13 @@ What it should look like:
rest.js
/srv/walnut/packages/client-api-grants/example.com
'''
hello@example.com
'''
```
The Daplie Seed App
-------------------
Setup the Seed App (front-end)
------------------------
Get the Seed App
@ -169,7 +213,7 @@ echo "seed@example.com" >> /srv/walnut/var/sites/$my_domain
popd
```
Change the authenication from `oauth3.org` to your domain (i.e. `provider.example.com`)
You will need to change the authenication provider/issuer URL from `oauth3.org` to the domain you've selected (i.e. `provider.example.com`)
```
vim /srv/walnut/packages/pages/seed@example.com/js/config.js
@ -179,3 +223,8 @@ vim /srv/walnut/packages/pages/seed@example.com/js/config.js
{ "azp@oauth3.org": { issuer_uri: 'provider.example.com', client_uri: 'example.com' } }
```
See Hello World
---------------
Now visit your site (i.e. https://example.com) and you will be able to login
and access the hello world data.