Trying to deploy a website returns error

Service ID: 643c8ee2-66dc-413e-bcca-2d08a9c73466 Hi!! I'm trying to deploy a web app to railway. Sorry if I say something wrong but this is my first time working with websites. We have a website written in http, css, php and javascript which i loaded on github but trying to deploy it on railway I get the error: " context: f62c7b62599d441440438a1ad86d113c Nixpacks build failed Nixpacks was unable to generate a build plan for this app. Please check the documentation for supported languages: https://nixpacks.com The contents of the app directory are: b ootstrap/ Login/ Registrazione/ Errore/ SQL/ Home/ Images/ PHP/ Utenti/ " I'll leave the file structure of the project. Thanks in advance for the help!
Getting Started | Nixpacks
App source + Nix packages + Docker = Image
54 Replies
Percy
Percy2y ago
Project ID: 643c8ee2-66dc-413e-bcca-2d08a9c73466
Brody
Brody2y ago
php files should be inside an app directory, what framework is this?
Alberto
AlbertoOP2y ago
It should have been written without any framework (not by me) 🤔
Brody
Brody2y ago
okay well usually site files for a php project go into an app directory
Alberto
AlbertoOP2y ago
Ok, so should I move every file and directory into a root folder called app? Or simply put every php file into an app folder?
Brody
Brody2y ago
yeah i assume so, thats the folder railway will use
Alberto
AlbertoOP2y ago
wait sorry the first or the second? 😅
Brody
Brody2y ago
oh sorry, just the php files for the website
Alberto
AlbertoOP2y ago
Hi, thanks for the tips! I've tryed to put all of the php code inside an app directory like in the image. Now the deployment goes on for longer but still returns the same error as before !
Brody
Brody2y ago
can you send me a link to your repo?
Alberto
AlbertoOP2y ago
GitHub
GitHub - AlbertoNoris/MPP: test website
test website. Contribute to AlbertoNoris/MPP development by creating an account on GitHub.
Alberto
AlbertoOP2y ago
This is a new repo that I've built in order to make it public so the previous projectID doesn't match
Brody
Brody2y ago
that's fine, I can't do anything with a project id anyway
Alberto
AlbertoOP2y ago
ahahah ok
Brody
Brody2y ago
whats with the capital letters on the index files?
Alberto
AlbertoOP2y ago
I'm used to camel case
Brody
Brody2y ago
you should only have a sinlge index file named index.php
Alberto
AlbertoOP2y ago
Ok, working on it
Brody
Brody2y ago
$dbconn = pg_connect("host=localhost port=5432 dbname=Intersection user=postgres password=BIAR") thats also not gonna work on railway
Alberto
AlbertoOP2y ago
For test porpouses do you reccomend removing it?
Brody
Brody2y ago
that would just cause more errors
Alberto
AlbertoOP2y ago
Thanks again I'm gonna try it tomorrow!
Alberto
AlbertoOP2y ago
Ok so I've put every file inside the app folder, created only one file with the name "index" and fixed the connection to the postgre databse by connecting it to a railway deployd postgre database. But while the website locally on my machine runs fine when I deploy it on railway I can only see one (broken) page and when I try to click on a new page of the website it returns "file not foud" https://intersection-production.up.railway.app/ . Do you have any tips? Maybe the structure of the folders are still wrong? It seems like the website cannot find the other pages but I cannot figure out how to fix it! Thanks in advance!!
Intersection
Intersection between professionals and companies site
Brody
Brody2y ago
um, you are using your database password in plaintext thats not the main issue, but its something you should fix asap
Alberto
AlbertoOP2y ago
Yeah I know I'll fix it asap but first I wanted to at least see the website running!
Brody
Brody2y ago
so in the root of your repo you have a WebSite folder, but in the root you should have the app folder, so bring your app folder into the root of the project then place all asset folders into a single asset or static folder at this point it's just a matter of correct folder structure
Alberto
AlbertoOP2y ago
You have to forgive me but I still don't get what I should do. 1. Thanks for the tip about hiding the passwords now they are hidden. 2. "in the root you should have the app folder, so bring your app folder into the root of the project" since the repo cotains also other folders which are not specific to the website can I just change the root directory in the settings of my deployment?
Alberto
AlbertoOP2y ago
3. "then place all asset folders into a single asset or static folder" do you mean that I need to put all of the folders inside of /app ? Right now this is the structure:
Alberto
AlbertoOP2y ago
I had to change the repo which now must be private so I cannot share it here but if you need anything just ask me and I'll send everything! btw thanks for the help and sorry if this stuff is trivial but I'm dying for this deplyment!!
Alberto
AlbertoOP2y ago
Just to be clear now the error is simply that the website doesn't work properly ( take a look here: https://website-production-39ee.up.railway.app/ ) wheares on my local machine the pages are all working properly!
Intersection
Intersection between professionals and companies site
Brody
Brody2y ago
you are setting the root directory to be /app, try just /WebSite
Alberto
AlbertoOP2y ago
If i try just /WebSite It fails
Alberto
AlbertoOP2y ago
Brody
Brody2y ago
your folder structure is just so un-orthodox, railway doesn't know what to make of it I don't even know how you managed to run it locally
Alberto
AlbertoOP2y ago
Ok I fixed it by simply putting everything inside the app folder
Brody
Brody2y ago
didn't I say to do that a while ago?
Alberto
AlbertoOP2y ago
Yeah but you were suggesting only the php files
Alberto
AlbertoOP2y ago
But no prob we figured it out I should have tried eralier
Brody
Brody2y ago
yeah my bad, I don't have any experience with php glad you got it solved though
Alberto
AlbertoOP2y ago
Hi! I still have some issues 😅 I'm trying to create a new file by doing file_put_contents($nameOfFile, $contentsToPutInsideFile); as usual in local everything works fine but when deployed I get the error "file_put_contents(): failed to open stream: permission denied" which looks like it should only be an error caused from permissions. But every forum I found online only talks about using the command line which from railway I don't have access to. For example a possibility was doing "chmod -R 777 /app" which I tried putting inside the Start Command of the deployment which results in the website deploying correctly on the railway page but on the website a text with "Server Error" is displayed. any tips? the app one was perfect and helped me going forward a lot!
Brody
Brody2y ago
I have seen our php guy say something about using a /storage folder? apparently that folder is available and has the correct perms, but I might be making that up lol
Alberto
AlbertoOP2y ago
I've tried but no luck unfortunately 😦 it still looks like I need to give write permission somehow
Brody
Brody2y ago
@aleks please advise? 🙏
root
root2y ago
You're using /app/storage?
Alberto
AlbertoOP2y ago
Fixed it!! Yeah it was the storage folder missing 😅 I still have one last issue and then I should be ready to have it public to the internet! Javascript seems to not work properly when deployed but it's fine on local. [what it should do]: in local when a user is registering we check if it has inserted the email after having pressed an "invia" (it means register) button. If the email hasn't been inserted a red box comes up under the text field in which you insert the email [what it does]: when deployed the red box comes up as soon as the page is loaded and not after the button has been pressed.
Alberto
AlbertoOP2y ago
I leave the file that containts the javascript and 2 images that should explain better wht's the error ... thanks as always for the help!! 💪💪💪
Brody
Brody2y ago
will take a crack at that when I have some time whats the railway domain that your app is running on
Alberto
AlbertoOP2y ago
Intersection
Intersection between professionals and companies site
Brody
Brody2y ago
look at the browser console errors for that registration page, fix the super simple console errors and your problem will be solved so that means use this link to load jquery lib instead of the google based link https://code.jquery.com/jquery-3.6.0.min.js
Alberto
AlbertoOP2y ago
Looking into it! 👀 No errors but now the error codes never show themselves even when the button is pressed
Alberto
AlbertoOP2y ago
I replaced it like this
Brody
Brody2y ago
yes looks good
Alberto
AlbertoOP2y ago
No ok I need to try again because now also in local it doesn't show
Brody
Brody2y ago
lol
Want results from more Discord servers?
Add your server