R
Railway•2y ago
spicyyriice

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
Percy
Percy•2y ago
Project ID: d2432f06-b0e2-44dc-8dea-bc07df66aea2
Brody
Brody•2y ago
you did not just publicly post your database credentials?? please go and regenerate the credentials in the database plugin's settings
spicyyriice
spicyyriiceOP•2y ago
Yes but I will delete the project after
Brody
Brody•2y ago
show me a screenshot of your service variables please
spicyyriice
spicyyriiceOP•2y ago
Where can I find thos services variables?
spicyyriice
spicyyriiceOP•2y ago
Is it this?
Brody
Brody•2y ago
start by clicking on the service that's the database plugin
spicyyriice
spicyyriiceOP•2y ago
spicyyriice
spicyyriiceOP•2y ago
I try to link those 2 services
Brody
Brody•2y ago
yes that looks good to me
spicyyriice
spicyyriiceOP•2y ago
but is it how we are supposed to do?
Brody
Brody•2y ago
full disclosure, I have absolutely no clue what piwigo is but is piwigo setup to use those specific environment variables?
spicyyriice
spicyyriiceOP•2y ago
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
spicyyriice
spicyyriiceOP•2y ago
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.
spicyyriice
spicyyriiceOP•2y ago
or I use docker-compose file, but railway doesnt support yet mildpanic
Brody
Brody•2y ago
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
spicyyriice
spicyyriiceOP•2y ago
you mean the values of name, password from the MySQL ?
Brody
Brody•2y ago
yeah
spicyyriice
spicyyriiceOP•2y ago
But how can I edit it?
Brody
Brody•2y ago
just click the raw editor button and update the names according to what piwigo expects them to be named
spicyyriice
spicyyriiceOP•2y ago
So instead of those values, i should replace these by the values from mySQL
spicyyriice
spicyyriiceOP•2y ago
Brody
Brody•2y ago
change the names of the variables don't touch the funky looking values or you will break stuff
spicyyriice
spicyyriiceOP•2y ago
Hmmm I changed the variables and still the same issue
spicyyriice
spicyyriiceOP•2y ago
spicyyriice
spicyyriiceOP•2y ago
I even hard coded
spicyyriice
spicyyriiceOP•2y ago
Brody
Brody•2y ago
show me another screenshot of your service variables
spicyyriice
spicyyriiceOP•2y ago
Brody
Brody•2y ago
are those the variable names piwigo expects?
spicyyriice
spicyyriiceOP•2y ago
Yes
Brody
Brody•2y ago
show me the error message please
spicyyriice
spicyyriiceOP•2y ago
spicyyriice
spicyyriiceOP•2y ago
Cannot connect to server
Brody
Brody•2y ago
1. you need to be using variable references. 2. what makes you think that those are the variable names piwigo uses?
spicyyriice
spicyyriiceOP•2y ago
Chatgpt told me that hahaha😅😅
Brody
Brody•2y ago
I didn't think it needed to be said, but you can't take information an AI tells you at face value
spicyyriice
spicyyriiceOP•2y ago
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?
Brody
Brody•2y ago
no I do not
Want results from more Discord servers?
Add your server