a year ago
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?
Create github repo
Push wordpress to the repo
Make a new railway project, mysql provisional
Get mysql info and update my wordpress' wp-config.php to have that new mysql info
Make a staging branch
Make a new Railway project that deploys from my github repo, and choose my wordpress repo
Im assuming this is wrong…..
0 Replies
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
a year ago
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.
Create github repo
Push wordpress to the repo
Use environment variables in wp-config.php for database configurations
Use environment variables for any other sensitive information
Make a new Railway project
5.a. Name the project
In the same project, deploy MySQL
Also in the same project, add a blank service
7.a. Name the service
7.b. Generate a domain for it
Add your database variables to the blank service
8.a. Use variable references the same as the template uses
Add any other variables you need
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.
a year ago
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
a year ago
please tell me where I'm wrong grid
a year ago
You can add a volume mapped to /var/www/html on the wordpress service
a year ago
a year ago
what if they want to pull the changes made to their wordpress site back down locally?
a year ago
like theme stuff and site media? you can just use a wordpress backup plugin
a year ago
i think the built in import/export tool in wordpress might cover that too, but i'd have to double check that one
a year ago
here's what is in my github repo for it as well
a year ago
gotcha, would my approach also work?
a year ago
yeah your steps are definitely correct, just the addition of adding the volume to the wordpress service on railway so the data persists
a year ago
if by "push wordpress to repo" do you mean the entire wordpress.zip file contents?
a year ago
because dockerfile in the repo would prob be easier, then just pull the docker image
a year ago
right but that then makes it so they they have to use round-about ways to get data back off of the service
a year ago
wordpress install + dockerfile
a year ago
hmm, i guess it depends on what they'll be wanting to do with the service data
a year ago
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?
a year ago
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.
a year ago
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
a year ago
for my usecase this works, relatively low traffic site for my landscaping company
a year ago
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?
a year ago
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?
a year ago
only one that pulls the wordpress docker image, but it can probably be tweaked easily:
```dockerfile
FROM wordpress:latest
COPY ./custom-php.ini /usr/local/etc/php/conf.d/
COPY --from=wordpress:latest /usr/src/wordpress/ /var/www/html/
COPY ./wp-config.php /var/www/html/
COPY ./.htaccess /var/www/html/
ARG MYSQLPASSWORD
ARG MYSQLHOST
ARG MYSQLPORT
ARG MYSQLDATABASE
ARG MYSQLUSER
ARG WPREDISHOST
ARG WPREDISPORT
ARG WPREDISUSER
ARG WPREDISPASSWORD
ARG PORT
ENV WORDPRESSDBHOST=$MYSQLHOST:$MYSQLPORT
ENV WORDPRESSDBNAME=$MYSQLDATABASE
ENV WORDPRESSDBUSER=$MYSQLUSER
ENV WORDPRESSDBPASSWORD=$MYSQLPASSWORD
ENV WORDPRESSTABLEPREFIX="RW_"
ENV WPREDISHOST=$WPREDISHOST
ENV WPREDISPORT=$WPREDISPORT
ENV WPREDISPASSWORD=${WPREDISUSER},$WPREDISPASSWORD
ENV PORT=$PORT
RUN echo "ServerName 0.0.0.0" >> /etc/apache2/apache2.conf
RUN echo "DirectoryIndex index.php index.html" >> /etc/apache2/apache2.conf
CMD ["apache2-foreground"]```
a year ago
you don't need any of those ARG or ENV lines btw
a year ago
huh, i'll remove them and see what happens then
a year ago
well you'd need to properly setup your service variables, but they aren't needed in the dockerfile
a year ago
you aren't using any environment variables during build so you don't need to reference anything
a year ago
yeah i've got them all setup in railway on the service as well so it should be fine then
a year ago
you are re-mapping variables there, you'd need to now do that in the service variables instead
a year ago
going trial by fire on this one, captain <:peepoCool:526260885929328640>
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?
a year ago
Unfortunately you would need to learn a bit about Dockerfiles to deploy wordpress to railway in the way i described
a year ago
step 2
Your repo would need to have a Dockerfile at the root of the repo
a year ago
i'm willing to do a proof of concept on brody's method as well, just gotta finish up some work things
a year ago
that way if you run into any issues trying this out yourself, i can be of some assistance
a year ago
thanks grid, i understand it at a high level but i havent deployed wordpress to railway myself
a year ago
bonus points if you do it with frankenphp
a year ago
i'll definitely take a stab at it
a year ago
the redis config definitely is not liking the env change lol
a year ago
use keydb 🙂
a year ago
i'm using your dragonfly template right now actually lmao, is keydb better?
a year ago
<:PepeLaugh:580592928703905792>
a year ago
dragonlyfly is better, it uses more base resources 🙂
a year ago
so in the dockerfile it had
```dockerfile
ARG WPREDISUSER
ARG WPREDISPASSWORD
ENV WPREDISPASSWORD=${WPREDISUSER},$WPREDISPASSWORD```
a year ago
on the service variables it was originally set as WP_REDIS_PASSWORD=${{Dragonfly.DRAGONFLY_PASSWORD}} WP_REDIS_USER=${{Dragonfly.DRAGONFLY_USER}}
a year ago
wouldnt you want this then?
WP_REDIS_PASSWORD=${{Dragonfly.DRAGONFLY_USER}},${{Dragonfly.DRAGONFLY_PASSWORD}}
a year ago
now i tried it as both WP_REDIS_PASSWORD=${{Dragonfly.DRAGONFLY_USER}},${{Dragonfly.DRAGONFLY_PASSWORD}}
and WP_REDIS_PASSWORD=['${{Dragonfly.DRAGONFLY_USER}}','${{Dragonfly.DRAGONFLY_PASSWORD}}']
and neither of those work
a year ago
does it render properly?
a year ago
yeah, checked both and they both looked good
a year ago
and from the redis wordpress plugin docs:
a year ago
a year ago
(the only ones necessary in my case are host, password, and port)
a year ago
where you always using dragonfly?
a year ago
not for the first handful of months, just added it in like january
a year ago
did you always use the private network with dragonfly?
a year ago
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
a year ago
have you reloaded the plugin?
a year ago
dragonfly? i have not
a year ago
no the redis plugin
a year ago
oh, no i can't access anything on the site haha
a year ago
but it just pulls from the env vars in wp-config.php
a year ago
a year ago
dragonfly doesnt do user name auth, can you try -
WP_REDIS_PASSWORD=${{Dragonfly.DRAGONFLY_PASSWORD}}
a year ago
same error unfortunately
a year ago
it was working with the user name auth when the dockerfile was doing the remapping which is strange
a year ago
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
a year ago
the filebrowser has shone a light on the issue
a year ago
wp-config.php from the repo isn't the one getting used, for whatever reason
a year ago
wp-config.php on the volume has
a year ago
we're in
a year ago
very odd
a year ago
guess i can remove wp-config.php from my repo then since it's not doing a damn thing lmao
a year ago
now i can't access wp-admin <:kekw:788259314607325204>
a year ago
😦
a year ago
put it all back, dont listen to me
a year ago
nah this is funny as hell lmao
a year ago
i'm going to figure this out
a year ago
to be fair, i could access wp-admin before i removed wp-config.php from the repo and the dockerfile
a year ago
lets see if it magically works when i bring them back
a year ago
it did not
a year ago
i think i've found something…
a year ago
well this is new
a year ago
it's trying to go to install.php for some reason
a year ago
this broken broken now
a year ago
it's like it's not reading the database properly
a year ago
because looking inside the options table, the rewrite for the admin page is there
a year ago
a year ago
are you using the correct variable names?
a year ago
yeah, just double checked those
a year ago
i'd also be getting a 500 status on the main page though if it wasn't able to connect
a year ago
mariadb logs are angry a bit
a year ago
a year ago
looks completely fine in dbgate though
a year ago
I've heard that before 😉
a year ago
whatever do you mean <:PepeLaugh:580592928703905792>
a year ago
quadruple check them
a year ago
all checks out to me
a year ago
it does look fine there
a year ago
i'm going to try public networking for mariadb instead and see what happens
a year ago
meh, no luck still
a year ago
very strange <:Hmmge:916388031970308166>
a year ago
what did you break so badly
a year ago
who would have thought deleting wp-config.php that wasn't even getting used from the repo would cause such an issue
a year ago
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
a year ago
okay so it isn't that lol
a year ago
hey, at least the frontend works still <:kekw:788259314607325204>
a year ago
lol
a year ago
i've had an epiphany on something, stay tuned
a year ago
it is working now
a year ago
do tell
a year ago
it was the object cache all along
a year ago
what was the fix?
a year ago
wiped volume on dragonfly and redeployed it and purged cloudflare cache
a year ago
lmao that sure is a fix
a year ago
i was talking to my wife and had to stop mid conversation and run off
a year ago
exact words "i will be back in 5 minutes or less, i've had an epiphany on something"
a year ago
it has been 18 minutes instead, but i took a break while deploys were happening to make her coffee so we're all clear
a year ago
<:peepocool:616741504542703646>
a year ago
pog
a year ago
now time to switch mariadb back to private networking lol