/t/ - Meta

Site Discussion

Files (Max 3)
[New Post]

(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.
Replies: >>531
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
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
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
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
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
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.
(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
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
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
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
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
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
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
Ah I see, yes I do have the all.js in that folder.
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
(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
(3.5KB, 627x150)
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
(7.6KB, 619x141)
See image for the list, see Pastebin for the logs: https://pastebin.com/Cdcd4kid
Replies: >>345
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
that looks nicely lightweight tbh.
Replies: >>348
(17.3KB, 833x403)
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
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.

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
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
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
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
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
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
>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
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?

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
cool. i have an extra box i can convert into a server to play around with it.
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.
(24.8KB, 432x441)
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.
(15.8KB, 879x232)
Getting this error.
Replies: >>395
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
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
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
Removing nodejs12 and installing nodejs10 instead solved the issue. 'npm install' didn't throw any errors this time.
Replies: >>403
>(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:
Replies: >>403
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.

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

Alright cool.
How do I rebuild after git pulling an update?
Replies: >>419
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.
Replies: >>468 >>475
I did a git pull but when executing gulp it says:
    throw err;

Error: Cannot find module '/home/jschan/configs/main.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
    at Function.Module._load (internal/modules/cjs/loader.js:562:25)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (/home/jschan/gulpfile.js:5:14)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
Replies: >>470
The config file has changed from .json to .js so that I could add comments to help people understand the settings. So you have to use a new config file.
1. cp configs/main.js.example configs/main.js
2. copy the settings you had from configs/main.json to configs/main.js
3. delete configs/main.json
Replies: >>471 >>474
I'll just wipe meh machine and reinstall everything.
Btw I hope you can make it so mod actions don't need a captcha. LynxChan does ask for a captcha at mod actions but you don't actually have to fill it in to ban or delete.
Replies: >>474
>ill wipe
Not worth wiping everything anon, its just a small change to the config files. Read again carefully >>470
>staff bypass captcha
There is no staff-only "mod view" like some other imageboards yet where you can bypass captchas. Since the public-facing pages are just static html, a captcha is needed for all users for CSRF (security) reasons.
Once I add some kind of staff-only view It will be possible to do staff actions without captcha. For now its not urgent since all the options still work.
Thanks for the hand-holding it's helpful to newcomers to setting up JSchan.
(60.4KB, 343x513)
Are you on IRC right now Tom?
Replies: >>504
Not in one, I rarely use IRC. Whats up? I can join one if you need to chat.
Replies: >>505
My Alphachan VPS expired so I need to set everything up again from scratch and I may or may not need assistance. I can and will start on my own at first but I'm pretty sure I'll run into issues again.
Replies: >>506
Alright, ill idle in the IRC you gave last time. just ping me in there if you end up needing me.
Replies: >>507
Alright. Hope I still remember it correctly :^).
(52KB, 769x661)
Alright, with a few directives from Tom, Alphachan is back up again.
Cheers Tom and don't forget to add that captcha folder to the setup ;).
>>217 (OP) 
Very interesting software. It even has liveposting (it seems, it would need activity to see that in action).
Replies: >>535
Thanks. It doesnt show other users typing, it just means new posts get sent over a websocket and show immediately instead of downloading new posts every x seconds with a timer like vichan/lynxchan.
Replies: >>537
How does this affect bandwidth?
Replies: >>538
Only necessary data will get sent over the websocket instead of downloading a whole json file for a single post every time a new post is made.
So it will be good for bandwidth I think. And better for the webserver by not constantly making redundant requests.
Of course, the json api still exists and is still used in some situations. For example if you lose connection and reconnect, it will use the json file to "catch-up" and fetch any posts it might have misssed while the connection was missing.
How do I add a logo to index.html?
I've tried adding relevant HTML code for it, but when I do gulp and then pm2 reload all it wipes the code again.
Replies: >>550
it needs to be in the template so edit views/pages/home.pug then do the gulp html and pm2 reload.
for info on how to formate the template https://pugjs.org/api/getting-started.html
Replies: >>552
You should make it so people can add things to the HTML pages using HTML code. Everyone has basic HTML knowledge, few have basic pug\JS knowledge.
Replies: >>554
You can put regular html in pug templates if you want, but pug is shorter and cleaner imo. there are html->pug converters for the inexperienced. https://html2pug.com
I dont agree that everyone knows html but if they did, pug is very easy.
Replies: >>555
If you can run an imageboard, you know basic HTML.
Replies: >>556
>>555 nice trips
Sorry late reply but like I said, you can put regular html in the template if you want. Converting all the templates to html might be possible, but I would really prefer to keep it mostly pug.

If you wanna make a PR for adding the homepage logo in template, and add a placeholder logo to gulp/res/img/logo.png ill merge it
(5.4KB, 768x112)
see this is why i hate pug shit. even trying to add something as simple as a logo leads to 'Internal Server Error' on the frontpage.
Replies: >>570
indentation error probably, or read the damn logs
Replies: >>572
Don't use that tone at me. How about you actually provide an easy way to add a damn logo to the front page or tell me what's wrong with the code I posted? Pugshit is undoable.
Replies: >>573
I said, you probably have an indentation mistake and need to check the logs. For example:
possible language: ruby, relevance: 13
1|chan  | 2020-01-01 03:18:04.996: Error: /home/jschan/jschan/views/pages/home.pug:9:1
1|chan  |     7| block content
1|chan  |     8| 	h1.board-title #{meta.siteName}
1|chan  |   > 9|     p
1|chan  | -------^
1|chan  |     10| 	.table-container.flex-center.mv-10.text-center
1|chan  |     11| 		table
1|chan  |     12| 			tr
1|chan  | Invalid indentation, you can use tabs or spaces but not bothIf you took my advice, it would solve your problem. How can you blame me for telling you to check the logs for the reason for the internal server error?
To anon who deleted their post about nginx error:
The nginx config is most likely not the problem unless you changed it.
However if you recently ran a git pull and updated, you will be missing new config options in your configs/main.js. That will cause errors in the backend (pm2 logs shows the backend logs). So you can either copy the missing values from the example to your existing config, or replace it completely, then pm2 reload all.
Replies: >>728
That was me and yeah it was a simple config error. Everything is working fine now.
Replies: >>763
New config option
Add pruneAfterDays: 30, to your config/main.js. lets you configure how long logs last before getting pruned, instead of being always 30 days. posting incase somebody like >>728 has issues again

76 replies | 11 files | 37 UIDs
Show Post Actions


Staff Actions:


- rules - faq - source code -