#Can I create a production E-commerce website on Railway?

15 messages · Page 1 of 1 (latest)

misty arch
#

I have to store user, orders and transaction details in mysql and just wanted to confirm that I can store all the things without fear that data might disappear due to some reason. Or server might crash and not restart or any other aspect that needs to be considered for a production level project.

Providing my project structure FYR:

knotty craterBOT
#

Project ID: ed9d81eb-a192-462c-8cf6-bf7778244e57

misty arch
#

ed9d81eb-a192-462c-8cf6-bf7778244e57

ebon matrix
#

Railway is absolutely fitted for production, so no need to worry SmileFluent
At first glance it looks correctly set up, but here's a few things to account for:

Database
I notice you have a database with a volume attached, it looks like you deployed the pre-set MySQL database Railway provides
It's already set up to store data persistently and should be ready for production use unless you changed any configurations you shouldn't have (like volume mount location)

Best Practices
best practice in this case would be to ensure you're connecting to your database over the private network
(referenced in the MYSQL_PRIVATE_URL variable in your MySQL service)

connecting to your database through that ensures you're using the private network which is faster and doesn't subject your services to egress fees

Services
Your services don't have volumes attached, volumes are what's used to store data persistently, if all your services only use your database to store persistent data then you should be good. Although if your services are supposed to store data or files persistently in their file directory then you may need a volume there as well

For example if one of your services allow for image uploads and store them in /images then you may need a volume mounted to /app/images, doing this will ensure any files in the /images directory are stored persistently and will exist across all deployments

glad oak
ebon matrix
#

My answer was specific to the question of persistent data storage, I didn't consider cost-optimization; I'll append best practices to such answers in the future though

glad oak
#

but do we really know they have their volume mounted to the correct location?

ebon matrix
#

but okay fine i see your point, I'll update my answer to be more specific sheriousbro

glad oak
#

it is unrealistic yes, but you can't make promises saying a users data will always be safe, because a users data is at the whims of the user

ebon matrix
#

yea fair enough

misty arch
#

Yeah I used the railway template for Mysql and concluding from your answer I guess I am good to go right?

I will try the private network thing

glad oak
#

as long as you're following all the best practices, you are good to go

misty arch
#

To use private url should I create a new variable named MYSQL_PRIVATE_HOST and assign host value to it form MYSQL_PRIVATE_URL because I require host seperately

glad oak
#

always use reference variables -

MYSQL_PRIVATE_HOST=${{MySQL.RAILWAY_PRIVATE_DOMAIN}}