How to set up a basic wordpress website?
I do see there is a template for Wordpress + Mysql, but does this mean that Railway it will create a github repo for me? Will I be able to view it on Github? Im guessing I wont be able to so now im looking into the manual method where it uses my own github repo
Would these be the steps?
1. Create github repo
2. Push wordpress to the repo
3. Make a new railway project, mysql provisional
4. Get mysql info and update my wordpress' wp-config.php to have that new mysql info
5. Make a staging branch
6. Make a new Railway project that deploys from my github repo, and choose my wordpress repo
Im assuming this is wrong.....
92 Replies
Project ID:
N/A
N/A
Ok wow, just being curious, I did use the wordpress template and it created the site super fast and I can see how it generates the variables, so now I understand more about the templates.....but I am confused as where this project was even deployed? What repo? Do I have access to it? Does it have CI/CD so I can push updates and make branches eg. staging? this is where I feel anxious as I have to do it manually in order to know all of this stuff but seems 10x harder
The template uses a docker image instead of a repo, this is great for getting a basic wordpress site up and running, but it provides no real access to the file structure of wordpress and anything you mentioned in your second message.
So, the steps you gave in your first message are extremely close to the correct steps, let me expand on some and get you the optimal flow.
1. Create github repo
2. Push wordpress to the repo
3. Use environment variables in wp-config.php for database configurations
4. Use environment variables for any other sensitive information
5. Make a new Railway project
5.a. Name the project
6. In the same project, deploy MySQL
7. Also in the same project, add a blank service
7.a. Name the service
7.b. Generate a domain for it
8. Add your database variables to the blank service
8.a. Use variable references the same as the template uses
9. Add any other variables you need
10. Attach your GitHub repo
10.a. Staging or main can be switched at any time
I'd like to mention that it is super unlikely that Railway is going to know what to do with the default Wordpress install.
And something else to keep in mind, when Wordpress is running on Railway it should be treated as a static site, meaning you do all your changes locally only and push them to github, since the filesystem is empherial anything you change on Wordpress when it's hosted will not persist between deployments.
Just wanted to drop in and add my two cents as someone running wordpress on railway, i have persistent data for my site and don't do anything locally then push to the repo
please tell me where I'm wrong grid
You can add a volume mapped to /var/www/html on the wordpress service
what if they want to pull the changes made to their wordpress site back down locally?
like theme stuff and site media? you can just use a wordpress backup plugin
i think the built in import/export tool in wordpress might cover that too, but i'd have to double check that one
here's what is in my github repo for it as well
gotcha, would my approach also work?
yeah your steps are definitely correct, just the addition of adding the volume to the wordpress service on railway so the data persists
if by "push wordpress to repo" do you mean the entire wordpress.zip file contents?
because dockerfile in the repo would prob be easier, then just pull the docker image
right but that then makes it so they they have to use round-about ways to get data back off of the service
wordpress install + dockerfile
hmm, i guess it depends on what they'll be wanting to do with the service data
for mine, i just take regular backups using the built-in export tool
wow, thanks for the reply. Ok, about the empherial/persistent comment, is this about where for example...I should not install a wordpress plugin via Wordpress dashboard, but via git push?
in my scenario, yes you would install plugins in your local wordpress project then push to github and then railway would deploy those changes.
in grid's scenario you use a volume and you can install plugins live on the deployment, but then getting your local project in sync with what's on railway is a chore in my opinion.
Im going to try your steps now @Brody thank you
that's the difference then, i don't do a local environment, I throw the site into "under construction" mode and make changes to prod then bring it back live
for my usecase this works, relatively low traffic site for my landscaping company
brody's way is definitely the way to go if you have a local environment
"I'd like to mention that it is super unlikely that Railway is going to know what to do with the default Wordpress install."
What does this mean?
Railway would not be able to deploy the default wordpress install, you will need to find a wordpress install that comes with a Dockerfile. Grid, do you have one on hand?
only one that pulls the wordpress docker image, but it can probably be tweaked easily:
you don't need any of those ARG or ENV lines btw
huh, i'll remove them and see what happens then
well you'd need to properly setup your service variables, but they aren't needed in the dockerfile
you aren't using any environment variables during build so you don't need to reference anything
yeah i've got them all setup in railway on the service as well so it should be fine then
you are re-mapping variables there, you'd need to now do that in the service variables instead
going trial by fire on this one, captain :peepoCool:
sorry, I am slow and not used to PaaS, im only familiar with VPS and I tried vercel before which worked but I cant do wordpress there. I dont understand this docker part being part of my setup. I understand how its used for the templates, like I mentioned in my post and how it can spin up a site quickly, but in my manual way, how do I work this docker file into my steps?
Unfortunately you would need to learn a bit about Dockerfiles to deploy wordpress to railway in the way i described
I shall do that, but which step in 1-10 involves the docker file?
step 2
Your repo would need to have a Dockerfile at the root of the repo
thank you!
i'm willing to do a proof of concept on brody's method as well, just gotta finish up some work things
that way if you run into any issues trying this out yourself, i can be of some assistance
thanks grid, i understand it at a high level but i havent deployed wordpress to railway myself
bonus points if you do it with frankenphp
i'll definitely take a stab at it
the redis config definitely is not liking the env change lol
use keydb 🙂
i'm using your dragonfly template right now actually lmao, is keydb better?
:PepeLaugh:
dragonlyfly is better, it uses more base resources 🙂
so in the dockerfile it had
on the service variables it was originally set as
wouldnt you want this then?
now i tried it as both and and neither of those work
does it render properly?
yeah, checked both and they both looked good
and from the redis wordpress plugin docs:
(the only ones necessary in my case are host, password, and port)
where you always using dragonfly?
not for the first handful of months, just added it in like january
did you always use the private network with dragonfly?
not originally, used the public networking before but after making the env changes just now public wasn't working either, so i changed it to private
have you reloaded the plugin?
dragonfly? i have not
no the redis plugin
oh, no i can't access anything on the site haha
but it just pulls from the env vars in wp-config.php
dragonfly doesnt do user name auth, can you try -
same error unfortunately
it was working with the user name auth when the dockerfile was doing the remapping which is strange
i'm going to hook up the file browser and delete the /wp-content/object-cache.php file from the volume and see what happens
the filebrowser has shone a light on the issue
wp-config.php from the repo isn't the one getting used, for whatever reason
wp-config.php on the volume has
:HACKERMANS: we're in
very odd
guess i can remove wp-config.php from my repo then since it's not doing a damn thing lmao
now i can't access wp-admin :kekw:
😦
put it all back, dont listen to me
nah this is funny as hell lmao
i'm going to figure this out
to be fair, i could access wp-admin before i removed wp-config.php from the repo and the dockerfile
lets see if it magically works when i bring them back
it did not :PepeLaugh:
i think i've found something...
well this is new
it's trying to go to install.php for some reason
this broken broken now
it's like it's not reading the database properly
because looking inside the options table, the rewrite for the admin page is there
are you using the correct variable names?
yeah, just double checked those
i'd also be getting a 500 status on the main page though if it wasn't able to connect
mariadb logs are angry a bit
looks completely fine in dbgate though
I've heard that before 😉
whatever do you mean :PepeLaugh:
quadruple check them
all checks out to me
it does look fine there
i'm going to try public networking for mariadb instead and see what happens
meh, no luck still
very strange :Hmmge:
what did you break so badly
who would have thought deleting wp-config.php that wasn't even getting used from the repo would cause such an issue
time to link the filebrowser back up and compare the current wp-config.php to the one that was there before removing wp-config.php from the repo and see if there is some difference
okay so it isn't that lol
hey, at least the frontend works still :kekw:
lol
i've had an epiphany on something, stay tuned
it is working now
do tell
it was the object cache all along
what was the fix?
wiped volume on dragonfly and redeployed it and purged cloudflare cache
lmao that sure is a fix
i was talking to my wife and had to stop mid conversation and run off
exact words "i will be back in 5 minutes or less, i've had an epiphany on something"
it has been 18 minutes instead, but i took a break while deploys were happening to make her coffee so we're all clear
:peepocool:
pog
now time to switch mariadb back to private networking lol