Possible to setup Wordpress without using Docker?
adamatronix
HOBBYOP

a year 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

a year ago

N/A


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

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


a year ago

@adamatronix does the thread you are following use docker?


adamatronix
HOBBYOP

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


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


a year ago

Let me look online a bit


adamatronix
HOBBYOP

a year ago

I am currently using ddev for local dev.


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


a year ago

That “isnt intended” thing doesnt sound right though haha


a year 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

a year 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

a year ago

Hi, I ended up going the Docker route, and had Cursor complete a Dockerfile for me:

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

a year 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

a year ago

I am getting two errors:

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

a year ago

and

failed to calculate checksum of ref nbjtzb2ouvngui51l8d4ut8zz::842sh9kus4xb4m74lpxaiwxtr: "/wp-config-env.php": not found```


adamatronix
HOBBYOP

a year ago

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


a year ago

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


a year 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

a year ago

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


adamatronix
HOBBYOP

a year ago

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


a year ago

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


a year ago

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


a year ago

Didnt know that was a rule


a year ago

#🛂|readme #5


a year ago

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


a year ago

^ This is the correct course of action


a year 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 10 months ago


Status changed to Solved chandrika 10 months ago


Welcome!

Sign in to your Railway account to join the conversation.

Loading...