joe
joe
RRailway
Created by Cara Kessler on 1/9/2024 in #✋|help
Deployment disrupting an in progress cron job
maybe put them in a separate service if necessary/applicable
9 replies
RRailway
Created by Prodigga on 1/15/2024 in #✋|help
Can't add Cron Schedule
FYI depending on what you mean, the convention might be to use automated testing in your CI/CD pipeline for this rather than a cron job
30 replies
RRailway
Created by joe on 10/8/2023 in #✋|help
Dockerfile build doesn't get PORT arg (railway CLI)
huh, ok
15 replies
RRailway
Created by joe on 10/8/2023 in #✋|help
Dockerfile build doesn't get PORT arg (railway CLI)
I was going to mark my message as the solution for future reference
15 replies
RRailway
Created by joe on 10/8/2023 in #✋|help
Dockerfile build doesn't get PORT arg (railway CLI)
@Brody did you mark this as solved yourself? It's only been one day
15 replies
RRailway
Created by joe on 10/8/2023 in #✋|help
Dockerfile build doesn't get PORT arg (railway CLI)
For future readers, I had to specify 0.0.0.0 in the Listen and VirtualHost directives, like this... Listen 0.0.0.0${PORT} <VirtualHost 0.0.0.0${PORT}>
15 replies
RRailway
Created by joe on 10/8/2023 in #✋|help
Dockerfile build doesn't get PORT arg (railway CLI)
I checked both apache config files locally and on railway. They have the correct contents
15 replies
RRailway
Created by joe on 10/8/2023 in #✋|help
Dockerfile build doesn't get PORT arg (railway CLI)
Here's the Dockerfile. It works perfectly on my local machine:
FROM php:8.2-apache

ARG PORT
ENV PORT=$PORT

COPY ./src/ /var/www/html/

# Change the port numbers in apache's config files...

# Comment out all ports that are not in an IfModule block
RUN sed -i '/<IfModule/,/<\/IfModule>/! s/^\(Listen [0-9]*\)/# Disabled in image build step:\n# \1/' /etc/apache2/ports.conf
# Add correct port to end of file
RUN echo "Listen ${PORT}" >> /etc/apache2/ports.conf

# Output file contents for debugging
RUN cat /etc/apache2/ports.conf

# Duplicate the first occurrence of a VirtualHost opening tag and comment out the duplicate
RUN sed -i '/<VirtualHost/{p;h;s/^/# Disabled in image build step:\n# /g}' /etc/apache2/sites-available/000-default.conf
# Change the original with the correct port
RUN sed -E -i "0,/VirtualHost \*:[0-9]+/s//VirtualHost *:${PORT}/" /etc/apache2/sites-available/000-default.conf

# Output file contents for debugging
RUN cat /etc/apache2/sites-available/000-default.conf

RUN echo PORT value: $PORT
CMD echo PORT value: $PORT

EXPOSE $PORT
FROM php:8.2-apache

ARG PORT
ENV PORT=$PORT

COPY ./src/ /var/www/html/

# Change the port numbers in apache's config files...

# Comment out all ports that are not in an IfModule block
RUN sed -i '/<IfModule/,/<\/IfModule>/! s/^\(Listen [0-9]*\)/# Disabled in image build step:\n# \1/' /etc/apache2/ports.conf
# Add correct port to end of file
RUN echo "Listen ${PORT}" >> /etc/apache2/ports.conf

# Output file contents for debugging
RUN cat /etc/apache2/ports.conf

# Duplicate the first occurrence of a VirtualHost opening tag and comment out the duplicate
RUN sed -i '/<VirtualHost/{p;h;s/^/# Disabled in image build step:\n# /g}' /etc/apache2/sites-available/000-default.conf
# Change the original with the correct port
RUN sed -E -i "0,/VirtualHost \*:[0-9]+/s//VirtualHost *:${PORT}/" /etc/apache2/sites-available/000-default.conf

# Output file contents for debugging
RUN cat /etc/apache2/sites-available/000-default.conf

RUN echo PORT value: $PORT
CMD echo PORT value: $PORT

EXPOSE $PORT
15 replies
RRailway
Created by joe on 10/8/2023 in #✋|help
Dockerfile build doesn't get PORT arg (railway CLI)
ok, in a different service (ID: 108e166f-6409-417f-ab3a-fbf9884561f0), I tried setting PORT=8080 in my service variables and the port was accessible in both build and deployment, so my app should be listening on 8080, but I'm getting 503, "Application failed to respond" when I visit the public URL (https://grandiose-friction-production.up.railway.app/)
15 replies