IrisPumila
IrisPumila
RRailway
Created by IrisPumila on 7/30/2023 in #✋|help
Unable to Redeploy
5 replies
RRailway
Created by IrisPumila on 7/30/2023 in #✋|help
MySQL is Unstable
I'm using MySQL on Railway, but it's not stable. The same SQL sometimes gives an error and sometimes doesn't; its behavior is suspicious. When I restart the DB, the queries respond consistently, but there's no response when I try to execute a query from Python. I'm also getting the following errors in MySQL. It seems to be a configuration issue: 2023-07-30T08:00:38.853440Z 0 [Warning] [MY-011068] [Server] The syntax '--skip-host-cache' is deprecated and will be removed in a future release. Please use SET GLOBAL host_cache_size=0 instead. 2023-07-30T08:00:38.855623Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.33) starting as process 1 2023-07-30T08:00:38.863104Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started. 2023-07-30T08:00:39.051646Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended. 2023-07-30T08:00:39.352836Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed. 2023-07-30T08:00:39.352876Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel. 2023-07-30T08:00:39.355394Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory. 2023-07-30T08:00:39.410495Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.33' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server - GPL. 2023-07-30T08:00:39.410472Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /var/run/mysqld/mysqlx.sock What's the most stable database on Railway that also has good compatibility with Python? I personally want to use MySQL, but it's unstable. If there's a way to make it stable, please tell me. Thank you in advance.
7 replies
RRailway
Created by IrisPumila on 7/30/2023 in #✋|help
Running discord.py on Railway, but print statements are not output as logs.
Although I should be doing stdout with print statements, for some reason they are not output in the log. For example, the following source code does output:
#!/usr/bin/env python3.6
import pymysql.cursors

con = pymysql.connect(
host = 'contap',
user = 'root',
password = '',
database = 'railway',
port = ,
cursorclass=pymysql.cursors.DictCursor
)

cursor = con.cursor()

cursor.execute("select * from server_configs;")
result = cursor.fetchall()
print(result)
print(result[0]['night_base_time'])
#!/usr/bin/env python3.6
import pymysql.cursors

con = pymysql.connect(
host = 'contap',
user = 'root',
password = '',
database = 'railway',
port = ,
cursorclass=pymysql.cursors.DictCursor
)

cursor = con.cursor()

cursor.execute("select * from server_configs;")
result = cursor.fetchall()
print(result)
print(result[0]['night_base_time'])
However, when I switch to code that includes discord.py, there is no output. Even if I pasted the above code at the very top, the result was the same. I can't provide all the code for discord.py, but I will provide a part of it. When run on a CentOS 8 environment, the print statements are displayed correctly.
@client.event
async def on_ready():
print(f'{client.user} has connected to Discord!')
for guild in client.guilds:
server_configs[guild.id] = default_config.copy()
postable_channel_found = False
for channel in guild.channels:
if isinstance(channel, discord.TextChannel):
perms = channel.permissions_for(guild.me)
if not perms.send_messages:
continue
if not postable_channel_found:
server_configs[guild.id]['channel_id'] = channel.id
server_configs[guild.id]['channel'] = channel
print(f"Default post channel for {guild.name} set to {channel.name} with ID {channel.id}.")
await channel.send(" has started. Please input your settings.") # Send message to channel
postable_channel_found = True
else:
break
@client.event
async def on_ready():
print(f'{client.user} has connected to Discord!')
for guild in client.guilds:
server_configs[guild.id] = default_config.copy()
postable_channel_found = False
for channel in guild.channels:
if isinstance(channel, discord.TextChannel):
perms = channel.permissions_for(guild.me)
if not perms.send_messages:
continue
if not postable_channel_found:
server_configs[guild.id]['channel_id'] = channel.id
server_configs[guild.id]['channel'] = channel
print(f"Default post channel for {guild.name} set to {channel.name} with ID {channel.id}.")
await channel.send(" has started. Please input your settings.") # Send message to channel
postable_channel_found = True
else:
break
Is there a problem where print statements are not output when using discord.py? Or do I need to set something up? I would appreciate it if you could let me know. Thank you in advance.
12 replies
RRailway
Created by IrisPumila on 3/16/2023 in #✋|help
Verify via Payment Method
9 replies
RRailway
Created by IrisPumila on 3/15/2023 in #✋|help
How to set environment variables when deploying using CLI
I know that it is not possible to set environment variables via "railway variables set" when deploying using the CLI. So, I would like to know how to automatically set the environment variables from the ".env" file when I prepare the ".env" file and the "Dockerfile" and deploy them. The contents of "Dockerfile" are as follows. FROM python:3.11 WORKDIR /bot COPY requirements.txt /bot/ RUN pip install -r requirements.txt COPY . /bot CMD python main.py
9 replies
RRailway
Created by IrisPumila on 3/14/2023 in #✋|help
Can't set variables on CLI
Environment variables cannot be set on the CLI. Am I using the command wrong? Here is log: [web@localhost git]$ railway variables set foo=foo error: unexpected argument 'set' found Usage: railway variables [OPTIONS] For more information, try '--help'.
9 replies