Ask coding questions

← Back to all posts
Keeping repl permanently alive.
StringentDev (229)

So I have been making a repl that allows you to store items online but every time, after a certain amount of time, it shuts down the express server (nodejs) and it loses all data except users that have registered. Can someone help me to keep it online (eg. An example that works)?

Thanks in advance.

Note: the server is based off lolisafe and the script is at lolisafe.js.

Edit: db is not an option and uptime robot lasts 2 months.

Comments
hotnewtop
[deleted]

use this:
ping.mat1.repl.co
just enter in the url, and ill keep the site up

StringentDev (229)

thanks it actually worked! @TaylorLiang

Pandapip2 (12)

If you can force the repl to crash using kill 1 when the repl crashes, then using the url ping.mat1.repl.co/__tail should turn the repl back on. Just have the repl run "kill 1" on exit, e.g. have a bash script that looks like this:
node main.js >> main.log
kill 1

StringentDev (229)

thanks for the heads up! @Pandapip2

DeBeast591 (141)

@TaylorLiang could pinging the site for a long time cause it to crash or be shut down by repl.it?

[deleted]

@DeBeast591 Nope. I had a site that I pinged for around 4 months. Didnt crash once

AkshitRai (0)

thanks man you are awesome

Coder100 (18208)

Try to make sure there are no errors first. Right now, there is a deprecation error.

StringentDev (229)

No I have to reboot, hard restore @Lethdev2019

Coder100 (18208)

It doesn't matter if it works or not, if there is a warning, it will be potentially fatal. @Lethdev2019

RohilPatel (1581)

Well, if you have items you need to save, you could use fs, which won't get rid of the sleeping part, but will store the data.

Coder100 (18208)

He already has the DB up, and in theory it should work, but REPL.IT has limitations @RohilPatel

Coder100 (18208)

Why did u say ok twice >:( @RohilPatel

SixBeeps (5222)

Either use a DB (the best option) or use UptimeRobot (another viable option, but I'd use this if absolutely necessary)

StringentDev (229)

Looking for a solution that lasts forever not two [email protected]

StringentDev (229)

It's the fact it does not save files @SixBeeps
[Edit] not fully

SixBeeps (5222)

@Lethdev2019 UptimeRobot lasts forever

StringentDev (229)

Not the free plan. Unless you want people to pay for a was meant to be free service. @SixBeeps

SixBeeps (5222)

@Lethdev2019
are you talking about this?

StringentDev (229)

Yes, plus the credits that you [email protected]

SixBeeps (5222)

@Lethdev2019 Okay, so here's the thing: those are logs. Basically, UTR keeps logs of each ping so that you can have a history of each ping's response. For your purposes, you do not need logs. It will keep pinging your site (keeping it alive) forever.

StringentDev (229)

It's not lettin me put in the url
@SixBeeps

StringentDev (229)

Ok can you Tell me how to make it not log stuff. @SixBeeps

Coder100 (18208)

You could turn off email responses @Lethdev2019

StringentDev (229)

How does that affect how long the server lives? @Coder100

StringentDev (229)

It still logs at the dashboard @Coder100

Coder100 (18208)

Yeah, it's supposed to do that, it's to monitor uptime, and since it always pings the website, it has the benefit of keeping it alive. @Lethdev2019

StringentDev (229)

Actually, looked up stuff (tried similar ideas as well) half the time it does not work or the repl become unstable @Coder100

SixBeeps (5222)

@Lethdev2019 UTR works perfectly fine for me (using a Django program)

SixBeeps (5222)

@Lethdev2019 Either way, they're both web repls.

Coder100 (18208)

The REPL becomes unstable because there is an error. @Lethdev2019

StringentDev (229)

@Coder100 well I cant launch it anymore due to something happening

StringentDev (229)

atually, i found mine is very stable to the point i can safley say that i could go to sleep and 1 day later, it is still running. @Coder100