Possible to setup Wordpress without using Docker?
adamatronix
HOBBYOP

7 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?

Solved$10 Bounty

28 Replies

adamatronix
HOBBYOP

7 months ago

N/A


noahd
EMPLOYEE

7 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.

noahd
EMPLOYEE

7 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.


noahd
EMPLOYEE

7 months ago

@adamatronix does the thread you are following use docker?


adamatronix
HOBBYOP

7 months ago

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?


noahd
EMPLOYEE

7 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.


noahd
EMPLOYEE

7 months ago

Let me look online a bit


adamatronix
HOBBYOP

7 months ago

I am currently using ddev for local dev.


noahd
EMPLOYEE

7 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.


noahd
EMPLOYEE

7 months ago

That “isnt intended” thing doesnt sound right though haha


noahd
EMPLOYEE

7 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.


kmsaikrishna
PRO

7 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.


adamatronix
HOBBYOP

7 months ago

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"]
```


adamatronix
HOBBYOP

7 months ago

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"]
`


adamatronix
HOBBYOP

7 months ago

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


adamatronix
HOBBYOP

7 months ago

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


adamatronix
HOBBYOP

7 months ago

I tihnk the first one, from other posts, can be fixed on Railway's end?


noahd
EMPLOYEE

7 months ago

It looks like an internet issue. Maybe wait and retry the deployment? Seems odd


noahd
EMPLOYEE

7 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


adamatronix
HOBBYOP

7 months ago

I am still getting it. It's on Railway's end since it's their network?


adamatronix
HOBBYOP

7 months ago

I've seen a post where a user had a similar issue, and Railway was able to fix it


noahd
EMPLOYEE

7 months ago

Hey @Brody hope you’re not too busy. Is this something that railway has to fix? Unfamiliar


adam
MODERATOR

7 months ago

please don’t ping the team. If team involvement is required, ping a conductor and we will flag the thread


noahd
EMPLOYEE

7 months ago

Didnt know that was a rule


adam
MODERATOR

7 months ago

🛂|readme #5


adam
MODERATOR

7 months ago

Is there a reason why you’re making your own Dockerfile and not using the wordpress template’s setup?


adam
MODERATOR

7 months ago

^ This is the correct course of action


brody
EMPLOYEE

7 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 7 months ago


Status changed to Solved chandrika 7 months ago


Loading...