8 months ago
I've been going through this post https://discord.com/channels/713503345364697088/1223265292936024116, but I'm not sure what the correct approach is. Locally I have my dev environment which I push my changes to github. Currently, I'm tracking all wordpress files in the repo so I can just deploy to a Railway service. But I am getting nginx 404 errors.
Is this approach even possible?
28 Replies
8 months ago
Its honestly best to try and deploy it with Docker. It may seem scary at first but Docker is such an amazing tool to work with I love it. I can provide some good guides if you are comfortable with learning or testing it out.
noahd
Its honestly best to try and deploy it with Docker. It may seem scary at first but Docker is such an amazing tool to work with I love it. I can provide some good guides if you are comfortable with learning or testing it out.
8 months ago
I personally went bare metal (hosted without a container just files in a folder) for a while because I didnt want to learn Docker but now its saved me so much time.
8 months ago
@adamatronix does the thread you are following use docker?
Ok are there guides regarding railway + wordpress docker setup? My understanding there are already templates with wordpress docker, but I dont know how to pull in my wordpress code from github. Are people using volumes or a separate service?
8 months ago
Im personally unfamiliar with wordpress but am with docker. If the code is “contained” and you start it with a command you can dockerize it most definitely.
8 months ago
Let me look online a bit
8 months ago
So (still not the most knowledgeable when it comes to wordpress specifically) i looked around online and found this.
Apparently wordpress isnt intended to be version controlled so trying to do it can cause issues. You can migrate the theme/plugins to the hosted railway image though.
8 months ago
That “isnt intended” thing doesnt sound right though haha
8 months ago
Google says
WordPress Core: While you can track specific elements like themes or plugins, it's generally not recommended to put the entire WordPress core files in your Git repository. This is because core updates are handled separately by WordPress itself. Instead, focus on version controlling your custom theme and plugin files within your /wp-content directory.
8 months ago
The way to do this in my opinion is, start a latest version of wordpress from a template then, export wordpress backup from your old site and then import it here. If you are using any plugins, import them as well.
Everything should work as usual. If there are no compatibility issues.
Hi, I ended up going the Docker route, and had Cursor complete a Dockerfile for me:
```# Use official WordPress image as base
FROM wordpress:latest
Install additional PHP extensions, tools, and Node.js
RUN apt-get update && apt-get install -y \
less \
mariadb-client \
vim \
curl \
&& curl -fsSL https://deb.nodesource.com/setup_18.x | bash - \
&& apt-get install -y nodejs \
&& rm -rf /var/lib/apt/lists/*
Set working directory
WORKDIR /var/www/html
Copy custom wp-config.php that supports environment variables
COPY wp-config-env.php /var/www/html/wp-config.php
Copy any custom themes, plugins, or uploads
COPY wp-content/ /var/www/html/wp-content/
Install npm dependencies for the sow theme
RUN if [ -f "/var/www/html/wp-content/themes/sow/package.json" ]; then \
cd /var/www/html/wp-content/themes/sow && npm install; \
fi
Build Tailwind CSS for the sow theme
RUN if [ -f "/var/www/html/wp-content/themes/sow/src/input.css" ]; then \
cd /var/www/html/wp-content/themes/sow && npx tailwindcss -i ./src/input.css -o ./src/output.css; \
fi
Set proper permissions
RUN chown -R www-data:www-data /var/www/html \
&& chmod -R 755 /var/www/html \
&& chmod -R 777 /var/www/html/wp-content/uploads
Create a health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD curl -f http://localhost/ || exit 1
Expose port 80
EXPOSE 80
Start Apache
CMD ["apache2-foreground"]
```
Hi, I ended up going the Docker route, and had Cursor complete a Dockerfile for me:
`# Use official WordPress image as base
FROM wordpress:latest
Install additional PHP extensions, tools, and Node.js
RUN apt-get update && apt-get install -y \
less \
mariadb-client \
vim \
curl \
&& curl -fsSL https://deb.nodesource.com/setup_18.x | bash - \
&& apt-get install -y nodejs \
&& rm -rf /var/lib/apt/lists/*
Set working directory
WORKDIR /var/www/html
Copy custom wp-config.php that supports environment variables
COPY wp-config-env.php /var/www/html/wp-config.php
Copy any custom themes, plugins, or uploads
COPY wp-content/ /var/www/html/wp-content/
Set proper permissions
RUN chown -R www-data:www-data /var/www/html \
&& chmod -R 755 /var/www/html \
&& chmod -R 777 /var/www/html/wp-content/uploads
Create a health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD curl -f http://localhost/ || exit 1
Expose port 80
EXPOSE 80
Start Apache
CMD ["apache2-foreground"]
`
I am getting two errors:
RUN apt-get update && apt-get install -y less mariadb-client vim curl && curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && apt-get install -y nodejs && rm -rf /var/lib/apt/lists/* failed to copy: httpReadSeeker: failed open: failed to do request: Get "https://registry-1.docker.io/v2/library/wordpress/blobs/sha256:a7df3fd7d6b0db0f584c7c10c5ad2392936521275511e6fa448dfbf13295b4ad": context canceled: context canceled
and
✕ [4/8] COPY wp-config-env.php /var/www/html/wp-config.php failed to calculate checksum of ref nbjtzb2ouvngui51l8d4ut8zz::842sh9kus4xb4m74lpxaiwxtr: "/wp-config-env.php": not found
I tihnk the first one, from other posts, can be fixed on Railway's end?
8 months ago
It looks like an internet issue. Maybe wait and retry the deployment? Seems odd
8 months ago
For this one, this is showing that the file you are copying doesnt exist. Try using a relative path with ./ based on it
I am still getting it. It's on Railway's end since it's their network?
I've seen a post where a user had a similar issue, and Railway was able to fix it
8 months ago
Hey @Brody hope you’re not too busy. Is this something that railway has to fix? Unfamiliar
8 months ago
please don’t ping the team. If team involvement is required, ping a conductor and we will flag the thread
8 months ago
Didnt know that was a rule
8 months ago
🛂|readme #5
8 months ago
Is there a reason why you’re making your own Dockerfile and not using the wordpress template’s setup?
8 months ago
^ This is the correct course of action
8 months ago
context cancelled is not the actual error here, it means that another command failed (wp-config not found) and caused a chain reaction to cancel all other parallel running commands.
Status changed to Open chandrika • 8 months ago
Status changed to Solved chandrika • 8 months ago