Skip to content

Commit

Permalink
readme
Browse files Browse the repository at this point in the history
  • Loading branch information
melikyants committed Jun 5, 2019
1 parent 763d739 commit a504d04
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 140 deletions.
80 changes: 12 additions & 68 deletions src/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,81 +34,25 @@ Yarn install does not work yet.
- **clone** existing **pages**, to create new pages
- **set** posts **publish date** (for CMSs only — if you will set date in future, the post won't publish until that time)
All this operations will be applied to the **site** path to which you specified in `config.yaml` file.
*Note:* that changes might be affected by your hosting provider's cache. There is a **preview** button, by clicking on which you can check your changes in the real time, but they will be applied after the cache will expire.

### **WebAdmin application consists of two applications:**

- **CRUD users app**for creating users (on port `:8080`, front-end is in folder `wwwAdmin`)
- **Editor app**for editing site pages content (on port `:9080`, front-end is in folder `www`)

In the **CRUD users app** you login with the _login_ `admin` and _password_ specified in `/WebAdmin/config.yaml` folder in the field `secret`.
To the **Editor app** you log in with the user created in the **CRUD users app**.
In `/WebAdmin/config.yaml` you specify a path to folder with _site_ which you've deployed in **Part 1** and which are _going to edit_ via **Editor app**.

### **Deploy steps**

1. Download the **source code** of WebAdmin app with the command:
```sh
$ mbakeX -m
```
1. **Create an account** (if you haven't one already) and database in [FireStore](http://console.firebase.google.com). Navigate to the _Service Accounts_ tab in your database project's settings page and press _Generate New Private Key_ button. A JSON file containing your service account's credentials will be downloaded. Next go to the _Authentication_ tab, click _Sign-in method_ and set _Email/Password_ method to _Enabled_.

1. Add the following **config files** next to their _examples_ accordingly:

- Rename downloaded FireStore Admin SDK file to: **`serviceAccountKey.json`** and place it to the root `/WebAdmin` folder.

- In folder `/WebAdmin/www` copy file `config.js.example`, rename it to **`config.js`** and paste it next to its example here in this folder.
- change _ip_ urls to your server or local ip address.
- change `appMount` field value to the path to your _editing site_.
- in the FireStore console go to _Project Overview_ tab, on the next screen click _</>_ icon, a popup _Add FireStore to your web app_ will appear. Fill the fields `apiKey`, `authDomain`, `projectId` values accordingly to your DB settings values.
- change the `siteName` field value to the _name_ of your _editing site_.


- In folder `/WebAdmin/wwwAdmin` copy file `config.js.example`, rename it to **`config.js`** and paste it next to its example here in this folder.
- change _ip_ url to your server or local ip address
- change `siteName` field value to the _name_ of your _editing site_.

- Copy file `config.yaml.example`, rename it to **`config.yaml`**, and edit the fields:
- change `appMount` field value to the _path_ to your _editing site_.
- fill the values of fields `FB_API_KEY`, `FB_AUTH_DOMAIN`, `FB_PROJECT_ID` accordingly to the values of your project database that you've already retrieved in the previous steps.
- you can also _change admin password_ (optional).
- **Admin**for creating users (http://localhost:9081/admin)
- **Editor**for editing site pages content (http://localhost:9081/editors)
1. From the root folder of `/WebAdmin` run command to **install _node_modules_**, compile them and run node:
```sh
$ yarn
$ tsc
## **To install/run the webadmin**
$ node index.js
// or:
// $ nohup node index.js &
// if you want node running after the terminal will be closed
```
1. From folders `/WebAdmin/www` and `/WebAdmin/wwwAdmin` accordingly run command to **compile** pug:
```sh
$ mbake .
```
1. in folders `/WebAdmin/www/assets` and `/WebAdmin/wwwAdmin/assets` accordingly run command to **compile** sass:
```sh
$ mbake -s .
```
1. Open in browser url with the **application to create users**:
1. To install webadmin:
```sh
[your-ip]:8080
// eg: http://0.0.0.0:8080
$ yarn add metaIntuition
$ yarn start
```
Open in browser url with the **application to edit site content**:
```
[your-ip]:9080
// eg: http://0.0.0.0:9080
```
1. **Login to** `[your-ip]:8080` is: `admin`, password is: `123456` (_Note: if you have changed the password in config.yaml, then use your new password from this file_). Create a new user here.
1. **Reset password** for just created user via received email and then **login to** `[your-ip]:9080` with this user's credentials.

2. open in your browser `**http://localhost:9081/setup**`
3. type if your admin email and password, emailjs configuration and path to your site
4. click setup, you will be redirected to the webadmin where type in your email with password which you entered at setup page
5. add editors which can have access to the editor
6. open admin with `**http://localhost:9081/admin/**`
7. open editor with `**http://localhost:9081/editors/**`
ngrok.com may help w/ during development
73 changes: 2 additions & 71 deletions src/setup/index.html
Original file line number Diff line number Diff line change
@@ -1,71 +1,2 @@
<!doctype html>
<html>

<head>
<script>var _start = Date.now()</script>
<title></title>
<meta charset='utf-8'>
<meta content='width=device-width,initial-scale=1' name='viewport'>
<script src='//cdn.jsdelivr.net/npm/[email protected]/dist/depp.min.js'></script>
<script src='//cdn.jsdelivr.net/npm/[email protected]/riot.min.js'></script>
<style>
.delayShowing {
opacity: 0
}
.blur {
-webkit-filter: blur(2px);
filter: blur(2px)
}
</style>
<script src='//unpkg.com/[email protected]/toolBelt.js'></script>
<script>window.ROOT = '../setup/'</script>
<link href='../setup/assets/css/spectreTop.css' rel='stylesheet'>
</head>

<body>
<script src='../setup/assets/js/loader.js'></script>
<div class='container grid-lg pl-setup-admin'>
<div class='columns'>
<div class='col-10 col-mx-auto column'>
<h2>Welcome!</h2>
<p>On the following page you will be able to setup your webadmin!</p>
<form class='grid-form' id='setup-config-form'>
<fieldset>
<legend>To setup your webadmin, you need to add email, password and setup emailJs account
</legend>
<div data-row-span='2'>
<div data-field-span='1'><label>Email</label><input name='email' type='email'
autocomplete='email'></div>
<div data-field-span='1'><label>Password</label><input name='password' type='password'
autocomplete='current-password'></div>
</div>
<div data-row-span='1'>
<div data-field-span='1'><label>Path of the site that webadmin should run for</label><input
name='path' type='text'></div>
</div>
<div data-row-span='1'>
<div data-field-span='1'><label>EmailJS <b>service_id</b></label><input name='service_id'
type='text'></div>
</div>
<div data-row-span='1'>
<div data-field-span='1'><label>EmailJS <b>template_id</b></label><input name='template_id'
type='text'></div>
</div>
<div data-row-span='1'>
<div data-field-span='1'><label>EmailJS <b>user_id</b></label><input name='user_id'
type='text'></div>
</div>
</fieldset><button class='btn mt-2 btn-primary js-btn-setup'>Setup</button>
</form><button class='btn mt-2 btn-error js-btn-delete'>Delete tables</button>
</div>
</div>
</div>
<script>depp.require(['setup'], function () {
var e = new BindSetup
$('.js-btn-delete').on('click', function () { e.deleteTable() }), $('form#setup-config-form').on('submit', function (n) { n.preventDefault(), e.createConfig(this) })
})</script>
<!-- mB v5.07.01 on 2019-06-04T19:16:57.985Z -->
</body>

</html>
<!doctype html><html><head><script>var _start=Date.now()</script><title></title><meta charset='utf-8'><meta content='width=device-width,initial-scale=1' name='viewport'><script src='//cdn.jsdelivr.net/npm/[email protected]/dist/depp.min.js'></script><script src='//cdn.jsdelivr.net/npm/[email protected]/riot.min.js'></script><style>.delayShowing{opacity:0}.blur{-webkit-filter:blur(2px);filter:blur(2px)}</style><script src='//unpkg.com/[email protected]/toolBelt.js'></script><script>window.ROOT='../setup/'</script><link href='../setup/assets/css/spectreTop.css' rel='stylesheet'></head><body><script src='../setup/assets/js/loader.js'></script><div class='container grid-lg pl-setup-admin'><div class='columns'><div class='col-10 col-mx-auto column'><h2>Welcome!</h2><p>On the following page you will be able to setup your webadmin!</p><form class='grid-form' id='setup-config-form'><fieldset><legend>To setup your webadmin, you need to add email, password and setup emailJs account</legend><div data-row-span='2'><div data-field-span='1'><label>Email</label><input name='email' type='email' autocomplete='email'></div><div data-field-span='1'><label>Password</label><input name='password' type='password' autocomplete='current-password'></div></div><div data-row-span='1'><div data-field-span='1'><label>Path of the site that webadmin should run for</label><input name='path' type='text'></div></div><div data-row-span='1'><div data-field-span='1'><label>EmailJS <b>service_id</b></label><input name='service_id' type='text'></div></div><div data-row-span='1'><div data-field-span='1'><label>EmailJS <b>template_id</b></label><input name='template_id' type='text'></div></div><div data-row-span='1'><div data-field-span='1'><label>EmailJS <b>user_id</b></label><input name='user_id' type='text'></div></div></fieldset><button class='btn btn-primary js-btn-setup mt-2'>Setup</button></form></div></div></div><script>depp.require(['setup'],function(){var e=new BindSetup
$('.js-btn-delete').on('click',function(){e.deleteTable()}),$('form#setup-config-form').on('submit',function(n){n.preventDefault(),e.createConfig(this)})})</script><!-- mB v5.07.01 on 2019-06-05T19:27:23.762Z --></body></html>
2 changes: 1 addition & 1 deletion src/setup/index.pug
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ block content
b user_id
input(type='text', name="user_id")
button.btn.btn-primary.js-btn-setup.mt-2 Setup
button.btn.btn-error.js-btn-delete.mt-2 Delete tables
//- button.btn.btn-error.js-btn-delete.mt-2 Delete tables
script.
depp.require(['setup'], function(){
var bindSetup = new BindSetup()
Expand Down

0 comments on commit a504d04

Please sign in to comment.