R
Railway

✋|help

Error running the application in the background.

AAlragi9/4/2023
I cannot or the screen -S command is not executed in my program, and I do not know what the solution is, knowing that the project does not work unless this procedure is implemented.
AAlragi9/4/2023
fadd4c5c-74c0-4fd7-a209-03a8f7029c8d
Mmantisinabox9/4/2023
You won’t have access to the screen command in a container deployment. Your best bet would be to run the services separately from one another or use multi run and build your own Dockerfile for launching your service
AAlragi9/4/2023
Can you guide me to create a Dockerfile? I will be grateful to you.
Bbrody1929/4/2023
you could also use parallel with nixpacks
what are the two commands you want to run at the same time
AAlragi9/5/2023
I did not understand you, sir, but I want to execute the screen -S command so that the application runs in the background. Did you understand me?
Mmantisinabox9/5/2023
Screen will not run in a docker container, you will need to either run multiple services or use parallel with nixpacks, or multi run inside of docker
Jjoshmo_dev9/5/2023
what kind of background process is it?
AAlragi9/5/2023
Well, which service should I work and how? Because frankly, I don’t know about them.
Can I provide you with the code so you can understand more?
Bbrody1929/5/2023
also tell us the commands you would run locally to get your project all up and running
Jjoshmo_dev9/5/2023
this would be good
if you're running a backend web service and it's just a cronjob btw your best bet is probably celery, or whatever
AAlragi9/5/2023
The commands to run the project are as follows:
After entering the file path
screen -S (file name)
python3 main.py
Then press Ctrl A and Ctrl D
Bbrody1929/5/2023
file name??
AAlragi9/5/2023
This is how I access the file from a VPS, for example.
Bbrody1929/5/2023
yeah but what is the file you want to run in the background
Jjoshmo_dev9/5/2023
what exactly is your web service(s) supposed to do?
it would make it much easier if we had a high-level view of what should happen instead of what you're doing at the moment
AAlragi9/5/2023
import os
from asyncio import create_task, create_subprocess_exec, subprocess, sleep

from mody.Redis import db
from mody.get_info import sudo_info
from mody.mod import Bot


async def auto_run():
while not await sleep(10):
proc = await create_subprocess_exec(
"screen",
"-ls",
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
)
stdout, stderr = await proc.communicate()
res = stdout.decode()
for session in db.smembers(f'{Bot.me.id}:{sudo_info.id}:sessions'):
if session[:50] not in res:
os.system(f'screen -d -m -S {session[:50]} python3 users.py {session}')


create_task(auto_run())


This is the full text of the code
Bot Telegram
Its name is users.py
Bbrody1929/5/2023
uh josh, you got this 🙂 have fun
Jjoshmo_dev9/5/2023
luckily i have experience with telegram bots lol
Bbrody1929/5/2023
me too, but i dont wanna open up that can of worms
AAlragi9/5/2023
🙂♥thank you sir
Jjoshmo_dev9/5/2023
what exactly does the code do? is it supposed to maintain some kind of web connection?
AAlragi9/5/2023
Why? Telegram bots are very interesting.
Bbrody1929/5/2023
i meant the can of worms as in that code you showed
AAlragi9/5/2023
The truth is that I cannot tell you what it does because I am not proficient in the Python language, but I can provide you with the text of the code for the file users.py.
Jjoshmo_dev9/5/2023
yeah to be honest remote shell code execution is not reaaaaaaaaaally something that should be hosted on railway... but uh
i don't represent railway so not my circus not my monkeys :shrug: but we should really find a way to not do that
Bbrody1929/5/2023
you are not wrong
AAlragi9/5/2023
Be optimistic, my friend, do not disappoint me 😩
Jjoshmo_dev9/5/2023
ok can you paste the code
AAlragi9/5/2023
Of course, give me a sec.
AAlragi9/5/2023
AAlragi9/5/2023
I think the code is too big, so I'll paste some of it
Bbrody1929/5/2023
how about you share your repo
AAlragi9/5/2023
great.
Project ID: fadd4c5c-74c0-4fd7-a209-03a8f7029c8d
Or you mean from github?
Bbrody1929/5/2023
yes the github repo
Bbrody1929/5/2023
neither me, josh, vin work for railway, so neither of can do anything with the id
AAlragi9/5/2023
Did you get what you wanted?
Bbrody1929/5/2023
this is looking a lot like a userbot
AAlragi9/5/2023
Will I get a solution? 👀
Bbrody1929/5/2023
is it s userbot?
AAlragi9/5/2023
correct
Yes.
Bbrody1929/5/2023
then we wont be able to help with this
https://railway.app/legal/fair-use
and i recommend you find a different place to host it, like a VPS
AAlragi9/5/2023
Oh please, the VPS issue is very expensive and doesn't run much at all
Bbrody1929/5/2023
its just simply not allowed, sorry
AAlragi9/5/2023
@josh Please.
Bbrody1929/5/2023
#🛂|readme #5
AAlragi9/5/2023
I don't know what you mean, but if you find a command that runs the command instead of using screen, it will undoubtedly work.
Bbrody1929/5/2023
you are not allowed to run a userbot on railway
Jjoshmo_dev9/5/2023
ok so i have the following advice to offer you:
1) you will probably need to host this as two different services and allow them to communicate with each other
2) probably don't open another help thread about this in the future because brody, the railway team and anyone who's affiliated with railway will probably not help you and won't be allowed to help you as writing a userbot is technically against TOS
3) because of 2) you should try roadmap.sh - it's a great way to learn python quickly
AAlragi9/5/2023
Ok, sorry, I didn't know.
Is it because railway cannot operate it or do you not operate it?
Bbrody1929/5/2023
sorry, im going to lock and close out this thread now, userbots are not allowed on railway, theres no two ways about that, running your bot on railway puts you at risk of getting banned from railway

Looking for more? Join the community!

Recommended Posts
Medical System To ProductionHello, I am developing a medical system and I want to put it into production using Railway so that eDeploy restarted near the endJust deployed a change (573e8198-6981-45c6-81ae-91d5210afc0c) and it got through the build, then staFiles uploadGood afternoon, I would like to create a small SaaS application and deploy it entirely to railway. Upgrade To Hobby Plan:Why am I unable to upgrade to a Hobby Plan? Your UI keeps getting stuck on this page each time I tryRedis not configured properly for DjangoHi, I'm trying to use Redis with Django and Channels. I keep getting this error message which seems Inspecting built Docker Image locallyHello I have an issue in my application when running in Railway. I would like to download the image Is there someway for me to choose a custom range in the observability?docker flask shows Application failed to respondRepo: https://github.com/chamuditha4/flask1 URL : https://flask-production-7492.up.railway.app/ prGetting 503 Server Error during load testsI'm load testing a simple fastapi backend running on railway. Using locust for load testing with 100Ideal way to compose and manage a full stack app?Railway doesn't really seem to be exposing an example of how one could/should compose a full stack aUsage estimatesSo im trying to make a simple project using a MySQL database and im trying to figure out how much itMy website is not running due to SSL supportThe browser is showing following message: alfajr.edu.pk uses an unsupported protocol. ERR_SSL_VERSIPricing/resource questionHere's a silly question, how should I decide on what plan to use for hosting? I'm pretty dumb at thiAny solution for Typebot 2.17? Still showing server errorAPI response timeHello! I am looking for the best place to deploy my API and I currently have the "Pro Plan" package.Added a template as CRON service and it shows "Your project has no deploys"I added this template to take automatic DB backup - https://railway.app/template/UGKaB8 I added a Cservice in only one environment?Is it possible to have certain service(s) only in specific environment? I am making a new cron job tdeploy not building uptried it already three times now canceled teh ones before at around 5 mins the third is currently atError connecting to Redis database.As shown in the picture, I cannot connect to the database. I do not know the reason, but I think thaLove Railway but confused on pricingHello! I’m currently using the free trial of Railway for a service, and I’m loving it. As my free tr