Can't connect MySQL with my piwigo app on railway.app
I wanna deploy my Piwigo project my on railway.app and I did 2 instances
An instance of MySQL
An instance of my repo that contains only a Dockerfile
Here's the link of the railway public project:
https://railway.app/project/d2432f06-b0e2-44dc-8dea-bc07df66aea2
Here's the content of this Docker file Dockerfile:
FROM alpine:3.10.3
LABEL maintainer="Moritz Heiber <[email protected]>"
ENV PIWIGO_VERSION="12.2.0" \
PIWIGO_CHECKSUM="824ee83f46654b68962263567f2957933d75b2bac016e6dbb9ea9df9a2a86e88"
RUN set -x && apk --no-cache add curl php7 php7-gd php7-mysqli php7-json php7-session php7-exif && \
curl -Lo /tmp/piwigo.zip "http://piwigo.org/download/dlcounter.php?code=${PIWIGO_VERSION}" && \
echo "${PIWIGO_CHECKSUM} /tmp/piwigo.zip" | sha256sum -wsc - && \
adduser -h /piwigo -DS piwigo && \
unzip /tmp/piwigo.zip -d /piwigo && \
install -d -o piwigo /piwigo/piwigo/galleries /piwigo/piwigo/upload && \
chown -R piwigo /piwigo/piwigo/local && \
apk --no-cache del curl && \
rm /tmp/piwigo.zip
WORKDIR /piwigo
USER piwigo
CMD ["php","-S","0.0.0.0:8000","-t","piwigo"]
In the piwigo side, I tried to put all informations from the database and it gives me this an error saying Cannot connect to server
How can fix this problem?39 Replies
Project ID:
d2432f06-b0e2-44dc-8dea-bc07df66aea2
you did not just publicly post your database credentials??
please go and regenerate the credentials in the database plugin's settings
Yes but I will delete the project after
show me a screenshot of your service variables please
Where can I find thos services variables?
Is it this?
start by clicking on the service
that's the database plugin
I try to link those 2 services
yes that looks good to me
but is it how we are supposed to do?
full disclosure, I have absolutely no clue what piwigo is
but is piwigo setup to use those specific environment variables?
Self hosted gallery
Well I did locally with docker commands
I can show you
I did locally these commands on my pc and it works
$ docker network create piwigo
$ docker run -d --name piwigo_mysql --network piwigo -e MYSQL_USER=piwigo -e MYSQL_PASSWORD=piwigo -e MYSQL_DATABASE=piwigo -e MYSQL_RANDOM_ROOT_PASSWORD=true mysql:8.0.18 --default-authentication-plugin=mysql_native_password
$ docker build -t piwigo-docker .
$ docker run -d --name piwigo --network piwigo -p 8000:8000 piwigo-docker
With this dockerfile from this repo
https://github.com/RichardLayhoutLao/gallery
GitHub
GitHub - RichardLayhoutLao/gallery
Contribute to RichardLayhoutLao/gallery development by creating an account on GitHub.
or I use docker-compose file, but railway doesnt support yet
it looks like the variable names you normal give to piwigo don't match what you have setup in your railway service, you can change the names of the variables in the railway service to match what piwigo is setup to use
you mean the values of name, password from the MySQL
?
yeah
But how can I edit it?
just click the raw editor button and update the names according to what piwigo expects them to be named
So instead of those values, i should replace these by the values from mySQL
change the names of the variables
don't touch the funky looking values or you will break stuff
Hmmm I changed the variables and still the same issue
I even hard coded
show me another screenshot of your service variables
are those the variable names piwigo expects?
Yes
show me the error message please
Cannot connect to server
1. you need to be using variable references.
2. what makes you think that those are the variable names piwigo uses?
Chatgpt told me that hahaha😅😅
I didn't think it needed to be said, but you can't take information an AI tells you at face value
I also base from docker files
Some use MYSQL_SOMETHING
I will see at home and tell you after
Do you know when docker-compose will be available in railway.app?
no I do not