Skip to content

Commit 8225043

Browse files
committed
up
1 parent ded51be commit 8225043

8 files changed

Lines changed: 15 additions & 105 deletions

File tree

INSTALL.md

Lines changed: 6 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,12 @@ Or like this: `npm --silent run gulp -- ...`.
5454

5555
## 5. System packages
5656

57-
You'll also need to install nginx and GraphicsMagick (for image resizing).
57+
You'll also need to install GraphicsMagick (for image resizing).
5858

5959
For MacPorts, the commands are:
6060

6161
```
6262
sudo port install GraphicsMagick
63-
sudo port install nginx +debug+gzip_static+realip+geoip
64-
65-
sudo port load nginx
6663
```
6764

6865
## 6. npm install
@@ -73,89 +70,19 @@ In the directory with javascript-tutorial-server, run:
7370
npm install
7471
```
7572

76-
## 7. Configuring Nginx from scratch
77-
78-
If you had no nginx before, then everything is simple.
79-
80-
The logs directory is `/var/log/nginx`.
81-
82-
Create it and set owner/permissions. For a personal computer, can do it like this:
83-
84-
```
85-
mkdir /var/log/nginx
86-
chmod 777 /var/log/nginx
87-
```
88-
89-
Create configs by running:
90-
```
91-
npm --silent run gulp -- config:nginx --prefix /opt/local/etc/nginx --root /js/javascript-tutorial-server --env development --clear
92-
```
93-
94-
Here `--prefix` -- is the directory for nginx config, usually `/etc/nginx`, for MacPorts it's `/opt/local/etc/nginx`.
95-
96-
The `--root` is where the server is located. If you used another path instead of `/js/javascript-tutorial-server`, then change it.
97-
98-
The `--clear` option clears all configs before creating the new ones. That's fine if you had no nginx before.
99-
100-
Also it's recommended to add this line to `/etc/hosts`:
101-
```
102-
127.0.0.1 javascript.in
103-
```
104-
105-
This host name is in the Nginx config already.
106-
107-
## 7.1. If node.js is installed already
108-
109-
If you already have nginx, make a backup of it's config files.
110-
111-
Then execute the prevous section without the `--clear` at the end:
112-
113-
```
114-
npm --silent run gulp -- config:nginx --prefix /opt/local/etc/nginx --root /js/javascript-nodejs --env development
115-
```
116-
117-
The command copies files from the directory `/js/javascript-tutorial-server/nginx` into the folder `--prefix`, but without removing old configs.
118-
119-
So if you had other sites in `sites-enabled`, they will not be removed.
120-
121-
Rerun nginx. Make sure your existing projects work.
122-
123-
## 8. Database
124-
125-
Copy the tutorial repo, for instance `javascript-tutorial-en`
126-
127-
```
128-
cd /js
129-
git clone https://github.com/iliakan/javascript-tutorial-en
130-
```
131-
132-
After that, import it with the command:
133-
```
134-
PLUNK_REMOTE_OFF=1 npm --silent run gulp -- tutorial:import --root /js/javascript-tutorial-en
135-
```
136-
137-
Here `/js/javascript-tutorial-en` -- the directory with the tutorial repository.
138-
139-
`PLUNK_REMOTE_OFF=1` disables automatic uploading of examples to plnkr.co.
140-
That requires to setup a plnkr session, and is not necessary to run the tutorial.
141-
142-
## 9. Run the site
14373

74+
## 7. Run the site
14475

14576
Run the site with the language in `NODE_LANG` variable:
146-
```
147-
HOST=127.0.0.1 PORT=80 ./dev en
148-
```
149-
150-
Or with default host 127.0.0.1 and port 3000:
151-
15277
```
15378
./dev en
15479
```
15580

156-
Then access the site.
81+
Then access the site at `http://127.0.0.1`.
15782

158-
If you have `127.0.0.1 javascript.in` in `/etc/hosts`, then the address will be `http://javascript.in:3000`.
83+
If you have `127.0.0.1 javascript.local` in `/etc/hosts`, then the address will be `http://javascript.local`.
84+
85+
Wait for a couple of seconds to build static assets.
15986

16087
## 10. Run in "Edit" mode
16188

@@ -165,8 +92,6 @@ In "Edit" mode the engine watches the tutorial directory, instantly picks the ch
16592
./edit en
16693
```
16794

168-
This uses the default `HOST=127.0.0.1`, `PORT=3000`, and the folder is `/js/javascript-tutorial-en`.
169-
17095

17196
# TroubleShooting
17297

dev

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ export NODE_LANG=$1
88
export NODE_ENV=development
99
export ASSET_VERSIONING=query
1010
export WATCH=1
11-
export SITE_HOST=http://javascript.in
11+
export SITE_HOST=http://javascript.local
12+
export PORT=80
13+
1214
npm --silent run gulp dev | bunyan -o short -l debug
1315

edit

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export NODE_LANG=$BRANCH
88
export NODE_ENV=production
99
export TUTORIAL_EDIT=1
1010
export PLUNK_REMOTE_OFF=1
11+
export PORT=80
1112

1213
npm --silent run -- gulp tutorial:import --root /js/javascript-tutorial-$BRANCH
1314
npm --silent run -- gulp edit --root /js/javascript-tutorial-$BRANCH

handlers/nodeExample/controller/node.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ function clean(pathOrPiece) {
2121

2222
exports.all = function*() {
2323

24-
// bad path: http://javascript.in/task/capslock-warning-field/solution
24+
// bad path: http://javascript.local/task/capslock-warning-field/solution
2525
if (this.params.serverPath === undefined) {
2626
this.throw(404);
2727
}

handlers/tutorial/client/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ function initSidebarHighlight() {
7171
for (var i = 0; i < h2s.length; i++) {
7272
var h2 = h2s[i];
7373
// first in-page header
74-
// >1, because when visiting http://javascript.in/native-prototypes#native-prototype-change,
74+
// >1, because when visiting http://javascript.local/native-prototypes#native-prototype-change,
7575
// top may be 0.375 or kind of...
7676
if (h2.getBoundingClientRect().top > 1) break;
7777
}

handlers/tutorial/tasks/edit.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ module.exports = function(options) {
1717

1818
var args = require('yargs')
1919
.usage("tutorial url is required.")
20-
.example("gulp tutorial:edit --url http://javascript.in/memory-leaks-jquery --root /js/javascript-tutorial")
20+
.example("gulp tutorial:edit --url http://javascript.local/memory-leaks-jquery --root /js/javascript-tutorial")
2121
.demand(['url', 'root'])
2222
.argv;
2323

markup.md

Lines changed: 0 additions & 18 deletions
This file was deleted.

modules/config/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ var config = module.exports = {
2525
// production domain, for tutorial imports, descriptions, etc
2626
// for the places where in-dev we must use a real domain
2727
domain: {
28-
main: 'javascript.in',
29-
static: 'javascript.in'
28+
main: 'javascript.local',
29+
static: 'javascript.local'
3030
},
3131

3232
server: {

0 commit comments

Comments
 (0)