/t/ - Meta

Site Discussion


Name
X
Subject
Email
Message
Files
Password
[New Post]


coding.gif
(336.7KB, 492x376)
For those crazy enough to try installing jschan, you can get some help directly from me here.
Also there is no database update scripts yet, so you will have to pay attention to this thread and be careful before making updates that change databse schema.
Continuing from my thread on /b/; I took your advice and removed the 2 uglify lines from gulpfile.js and ran gulp again and it worked this time! I was able to spawn the services too with 'npm run-script start'.
However, my next error is when I visit localhost:6379 in my browser I see a white page with the message '-ERR wrong number of arguments for 'get' command' which I assume has to do with redis and not so much with jschan itself.

PS: I tried to delete my thread on /b/ with the password I set but it gives an 'Internal Server Error'.
Replies: >>219 >>228
>>218
Yeah i was looking at the console and saw that error, lol. Patched it quickly and pushed a fix to git. You should be able to delete it now if you wish.
Also, 6379 iirc is the default port for redis. I'm not even sure if its accessible through a browser standaline, but you probably shouldn't do that.
Also, before you access the site through a browser, you should have nginx setup. It won't really be functional without it because the nodejs backend does not serve static html files, images, etc. It uses nginx for that.
I did make some changes lately to the redis wrapper, but nothing to do with the "get" method, so there shouldn't be a problem. Could you give more details of where exactly you see the error?
You can see errors from the backend in pm2 logs though I suspect most errors right now would be misconfiguration.
Replies: >>220
>>219
Ah so I'm completely doing it wrong, lol. I didn't install\config nginx because I'm running it in a virtual machine and I thought you only needed that if you really run it on the internet.
How *do* you access the chan though once everything is set up and connected?
Replies: >>221
>>220
Well if you had nginx it would be listening on either port 80 or 443.
I could add a dev mode tonight or tomorrow that removes the need for nginx, https cookies, etc and serves everything with nodejs. Probably easier that way.
Replies: >>222
>>221
I've deleted the nginx.conf and pasted the nginx example code, changing the paths to where my jschan folder is.
However when I try to start nginx it says 'nginx: [emerg] "upstream" directive is not allowed here' which is the first line of the config file.
Replies: >>223 >>227
>>222
That config file shouldnt replace the default nginx file because it contains some important stuff. its meant for the sites-available/sites-enabled folder and overrides the default server block.
Without a domain (because you are running in a dev environment/local) there will be additional complications like setting up self-signed https certificates. Unless you feel comfortable trying that on your own I would wait until I add a dev mode to skip nginx entirely.
Sorry I just didnt forsee anyone setting it up yet so the instructions arent very accomodating.
heh.png
(18KB, 638x349)
Welp, this is as close as I'll get for now.
By the way, is there supposed to be an index.html generated somewhere? Because I can't find it anywhere. The attached screenshot is just the 404 page renamed to index.html.
Replies: >>225
>>224
Yeah I can tell by that picture none of the css/js is loaded hence the ugly layout and no colour.
The backend/nodejs does generate index.html and saves it to static/html/index.html when you try to visit the page and updates itself hourly.
Replies: >>226
>>225
Ok well I probably have done a couple of things wrong because there was no index.html and indeed the css\js isn't loading even though the files are there.
I made some changes to the repo which you can git pull. Including another example nginx config and some changes to cookie code to support no https. To start in nohttps/development mode, first kill the pm2 daemon with pm2 kill then start it but this time with npm run-script start-dev. Adding a mode to fully substitute nginx will take longer than I first thought so I would rather not.

Once you have it restarted we can work on fixing your nginx config. Share whatever errors you get in nginx logs once you switch to develpoment mode so I can help with that.
In >>222 you also mentioned you deleted the nginx.conf file? nginx.conf is by default in /etc/nginx/nginx.conf (on debian at least) and contains some important directives that you shouldn't delete. To add a site to nginx you add the config (modified example config) into /etc/nginx/sites-available/<hostname/ip> and then make a symlink into /etc/nginx/sites-enabled to activate it.

Also if you have some IRC channel you prefer maybe that would make quick back+forth comms easier to help you.
Alright >>218 if you're still around I made a bunch of changes so you can run it in dev mode without nginx. You should pull the latest version and try again.
Replies: >>229
>>228
not him, but now even i'm interested Tom. maybe i'll make some time to have a play with it in a week or two. thanks for all the work.
Replies: >>230
>>229
Sounds good. I finally have my own local dev environment so I can make sure dev mode is working. I used to just test everything live, but I didn't want to cause this place downtime and obviously it's not a good idea
Replies: >>231
>>230 ahem.
OK, for anon who made post >>333 nad had some issues with setup, I can help.
The issue with the setup script which runs the "gulp" command was probably fine, they were just showing EEXIST  because the file already exists (i think you ran it twice). I updated it to ignore EEXIST errors.
As for nginx config, there are 3 things:
- main nginx config in /etc/nginx/nginx.conf
- default config in /etc/nginx/sites-available/default 
- your config (modified from the example one in config/nginx.example) in /etc/nginx/sites-available/domain.com where domain.com is your domain name.
You need to remove the default config in sites-available, then symlink your one to the sites-enabled folder. Read here: https://stackoverflow.com/a/18090302
Replies: >>337
>>336
Whoops, I forgot this was the appropriate thread for trying to install the alpha version.
Anyway, I think the nginx stuff isn't so important. I'm wondering more why there isn't an index.html, boards.html etc. generated. I have a feeling it has something to do with the gulpfile\pug installations.
Also: you recently made a change renaming 'theme.js' to 'all.js' in a lot of files except there is no 'all.js'.
Replies: >>338
>>337
Most pages including index.html are written to disk when you visit the page for the first time OR in the case of index, every hour when it updates it with the latest stats. Boards, login and management pages are dynamic so they wont appear on disk. 
The all.js should be created by the gulpfile scripts task which is part of the default gulp task (as seen in gulp --tasks):
possible language: csharp, relevance: 10
...
[01:25:21] └─┬ default
[01:25:21]   └─┬ <parallel>
[01:25:21]     ├── css
[01:25:21]     ├── scripts <-- its here, so 'gulp' will run it
[01:25:21]     ├── images
[01:25:21]     └─┬ <series>
[01:25:21]       ├── deletehtml
[01:25:21]       └── custompages
...If you dont have all.js in /static/js/all.js, try running gulp scripts after pulling the latest changes from git.
Replies: >>340
Also forgot to mention the reason faq.html works is because its part of the "custom pages" in views/custompages/*.pug. Anything in there gets built into a static page by the gulp task "custompages" and you can customise/add/remove them at your discretion.
Replies: >>340
>>338
Ah I see, yes I do have the all.js in that folder.
>>339
How come a correct nginx configuration is needed to generate the dynamic pages? Why does it already work fine for the static pages?
Replies: >>342
index.png
(38KB, 1411x493)
Ok I've done the symlink thingy and there now is an index.html
However still no news.html, create.html, login.html etc.
Replies: >>342
gscreenshot_2019-11-06-125533.png
(3.5KB, 627x150)
>>340
It can generate dynamic pages without nginx (dev mode) but nginx is strongly recommended for caching, https, proper redirects, serving files, etc.

Now, you mentioned in the other thread you got 502 error from nginx so the webserver part of the backend might not actualy be running to generate pages like login, news, create, etc as per >>341. The index is probably working because its generated by a separate process on a schedule "schedules" in pic related. You might be missing "chan" and "build-worker". Lmk what pm2 list and pm2 logs show and if there are any errors/anything interesting.
Replies: >>346
pm2list.png
(7.6KB, 619x141)
See image for the list, see Pastebin for the logs: https://pastebin.com/Cdcd4kid
Replies: >>345
>>343
Okay so some minor things:
- you need a captcha folder mkdir /home/jschan/static/captcha (i will update gulpfile/repo later to make one automatically)
- it warns you that you have no redis password, so maybe fix that at some point.

But nothing really stands out there for why you get a 502. 502 can be that nginx cant reach the backend because:
a) backend is down (appears to be fine)
b) nginx misconfigured.
So we are at B most likely. Did you copy and modify config/nginx.example into the file you have in sites-available? Sorry for the runaround, configuring nginx is just a pain in the ass to explain, hence the shitty instructions on the repo but I will do my best to help.
Replies: >>347 >>399
>>342
that looks nicely lightweight tbh.
Replies: >>348
nginx.png
(17.3KB, 833x403)
>>345
It probably is B. I personally hate nginx and configuring it. I have experience with it but it's still a pain in the ass. Note that I don't have a domain for it yet and am working with raw IPs. 
I've added a screenshot. Here's a pastebin to my config: https://pastebin.com/LLMgw1Sd

PS: do you have 4 chans because you have 4 cores?
PPS: is it possible to, perhaps in a later stage, drop the whole nginx necessity and allow JSchan\Node to handle the SSL stuff itself? Like LynxChan offers.
Replies: >>348
>>346
Its not too bad. I think it can be reduced some by storing template caches in redis so I am looking how to do that. Tbh its never gonna be a problem for small sites and mongodb will probably use the most ram.

>>347
Yes 4 for 4 cores. The ecosystem.config.js has the "instances" set to 0 to match cpu cores.
If I add ssl support and geoip handling to nodejs then yes, it would be possible to go completely without nginx with a performance penalty of course.
If you just want to use it minus those few things for now since you also dont have a domain anyway, then you can:
1. pm2 stop all stops all running
2. pm2 kill kill pm2
3. Stop nginx from running (on debian smth like sudo systemctl stop nginx)
4. npm run-script start-dev starts up in dev mode (runs some extra code to try and substitute nginx)
5. check pm2 logs and chan should say STARTING IN MODE: development instead of production.
6. Visit the ip:7000/index.html and it should work unless i forgot something.
7000 is default port in configs/main.json you can change it if you like.
Replies: >>350
>>349
Yeah that could be a number of things. A bit above the technical support level I can provide in this thread. Try withoug nginx by changing it to dev mode like I suggested in >>348.
If you get a domain and want to run it publicly (i guess you could run it publicly without one) then maybe we can get in contact elsewhere for faster realtime chat and I can help some more. I will see if a friend of mine has a spare machine to do a full install guide from start to finish and add it to the repo at some point.
Replies: >>351 >>355
>>350
I've changed some nginx stuff again (increased proxy buffering, worker connections etc). Now I'm getting '400 Bad Request
Request Header Or Cookie Too Large' even after I clear all my cache and cookies... Very strange.
Guess I'll try to run it in no nginx mode.
Replies: >>352
>>351
Adding ' large_client_header_buffers 4 16k;' to the site nginx.config solved that but now it's back to 502 Bad Gateway and 'upstream sent too big header while reading response header from upstream' again.
God I fucking hate nginx so much.
Replies: >>353
>>352
Yeah that sounds like an absolute clusterfuck. I don't even have those directives in my nginx config. "too big header?" i mean... unless your browser weirdly sends a big header for some reason. I have no clue. Its a long shot, but try increasing body size by adding client_max_body_size 10M; or whatever you want the max to be
Replies: >>354
>>353
Didn't work.
If I remove all the weird extra shit I just added and try to open news.html, it still gives the 502 error and 'upstream sent too big header while reading response header from upstream' in the logs and I don't know why.
I'm using default unmodded Pale Moon so nothing weird there.
Replies: >>356
>>350
>I will see if a friend of mine has a spare machine to do a full install guide from start to finish and add it to the repo at some point.
not him, but i'd really appreciate something like that able to spoonfeed me.
Replies: >>356
>>354
Anything in pm2 logs? Also do you have a preferred IRC or somewhere so I dont shit up this thread with a million short back and forth comments?

>>355
If he says no,  I have another server (occupied with some stuff right now) that will be free to use around the 20th.
Replies: >>357 >>358
>>356
cool. i have an extra box i can convert into a server to play around with it.
>>356
I like shitting up threads and threads being shat up.
DareNET on IRC, #jschan. Tor is allowed there btw.
Replies: >>360
Ok the nginx\dynamic pages thing is solved. I messed with the 'proxy_pass http://chan$request_uri;' line which I shouldn't have. Leave it like that.
caps2.png
(24.8KB, 432x441)
>>358
I changed the capcode/role signature thing you mentioned in IRC. So now you can have nothing after the capcode to show the role without typing it out. Pic related has a few examples, and I updated the faq page.
errrrrrrrrrrrrrrrrrr.png
(15.8KB, 879x232)
Getting this error.
Replies: >>395
>>394
That is not the full error. Like it says "last 15 lines". You need to show more lines with pm2 logs chan --lines 30 for example where 30 is the number of lines. Also would help if you specify what you were doing/when the error occurred.
Replies: >>396
>>395
It's after I run the 'npm run-script start' command. I suspect it's a nodejs\bcrypt issue because trying 'npm install' throws an error about bcrypt 3.0.6 failing. I'm going to install nodejs 10 to see if it solves the problem (current setup was with nodejs 12).
Replies: >>397
>>396
Yeah that error does have MODULE_NOT_FOUND so you might be missing bcrypt. If npm install failed you could also be missing other modules. Check the requirements for bcrypt here https://www.npmjs.com/package/bcrypt It lists dependencies and says it could also be an issue building because node-gyp does not work on 'pre' node versions. I just tried nodejs 12.13.0 (LTS) and it worked fine. You can manage node verions easily with https://github.com/nvm-sh/nvm
Actually I gonna take this site down for a few minutes to update my node version haha. Won't be long.
Replies: >>398
>>397
Removing nodejs12 and installing nodejs10 instead solved the issue. 'npm install' didn't throw any errors this time.
Replies: >>403
>>345
>(i will update gulpfile/repo later to make one automatically)
Don't forget to do this btw.
Replies: >>403
The full error was 'Cannot find module 'bcrypt' by the way, which is weird because I did run 'apt-get install bcrypt' beforehand and verified bcrypt was installed.
My imageboard I will use for testing:
https://alphachan.net
Replies: >>403
>>398
Glad you got it working. Downgrading works because they provide prebuilt binaries for older versions so you don't need all the dependencies to build from source.

>>399
Yeah damn I forgot that. I will put the fix alongside an update soon when I cleanup the gulpfile a bit.

>>402
Alright cool.
How do I rebuild after git pulling an update?
Replies: >>419
>>418
1. Goto your jschan folder
2. git pull
3. (sometimes) If there are new options in the example config files, you will have to update your config files to include them.
4. gulp
5. pm2 reload all
Then pages will rebuild next time you visit them.

gulp updates everything like css, scripts, images, removes the html and json files, etc. If you only want to update specific things, you can use different tasks:
gulp scripts script changes
gulp css stylesheet changes
gulp images image changes e.g. spoiler image, favicon
gulp html templete changes (also deletes json, fixing in an update)
There are more tasks and you can edit the source files if you know what you are doing, but you are on your own with that.

Connecting...
Show Post Actions

Actions:

Staff Actions:

Captcha:

- rules - faq - source code -