Railway App

Thanks for the kind reply @ben

In the discussion you provided they say to avoid putting the target files in GitHub using .gitignore

I wish I knew that before. Not too much information about how to use .gitignore properly with Wappler :frowning:

1 Like

Environment settings can be managed in the server connect options per target. So you can enter there any environment settings needed for your local development target, but use different ones for your live target that are already available on the server so you don’t have to enter them. @ben

2 Likes

Thank you, @George, for your attention.
I apologize if I am misunderstanding what you mean. As a new user of Wappler, I am not familiar with how the configurations in Server connect can prevent the exposure of database connection details when the project is published to Github. Could you please provide more information or clarification on this?

Hi @ben I had a few questions about how to setup a dev and live version of a website using Railway.

I see https://docs.railway.app/develop/environments but am not sure if it is needed? Since the site is deployed through GitHub I can make any changes I want locally in Wappler and if I don’t want to deploy them, I just don’t push the changes to GitHub right? Assuming I am working on this myself in Wappler is there any need for a live dev site?

I’m a bit more confused on the database side though. Is that where I should use the railway environments or would I be better off just making another database and calling one dev and one live? And how would I connect both databases in Wappler? If I add them both as direct database connections can they have the same name or would it cause issues with my server actions? Or would I make a new target and add the connection there? And if so, would both connections just be local since I am using GitHub to push the changes and not Wappler?

Looking forward to hearing your thoughts on this and thanks for introducing me to Railway, it seems a lot easier for people newer to this.

Oh also, regarding the target files showing on GitHub. If I have my GitHub repo private is that enough to keep it secure? Or should I add to the gitignore? Would adding **/.wappler/targets/ be correct?

Personally, I would always opt for a development environment where I can play around without it affecting the production version. A development database rather than the production database would be part of that environment.

As far as Github is concerned, a private repository would help to keep private information safe, but this is very subjective. How safe is private info when it is kept somewhere in the cloud?

Regarding Railway, you can choose to use it in several ways, one for development, one for staging and one for production. My initial thought was to make it easy ffor newbies to develop a database driven site without having to install local servers. From there on, it depends on further requirements.

Please note that these are my views, other’s views may differ.

3 Likes

I personally agree with Ben in many ways and looking back into my past projects (not Wappler) and the businesses I am working with, I would consider this advices as „best practices“.

2 Likes

Thanks for the info! One last thing if you don’t mind. I have having trouble setting up the database connections inside Wappler and was wondering if you could help.

I have a dev and production environment on Railway

that both have a MySQL database.

I add the dev one to the default development target


and it works fine.

For the live version, do I add a new target and just copy the settings from the dev target since I am publishing with Git and not Wappler?

and then edit the db connection with the live one for the new target?

when I try that I get an error

Or am I supposed to just use one target and have 2 database connections?

I appreciate any help you can provide.

2 targets, 1 database connection.

Make sure your Globals db connection is not open in a tab.

Set your active target to production.

Open the db connection in Globals and edit the connection as needed. Save the file.

If you then return the active target to dev, and reopen the db connection, you should see the dev connection details.

1 Like

Thats what I did when I got the error posted earlier. Double checked all the settings and now I see

I’m guessing it is because I have http://localhost:3000/ set for both targets but I don’t know what I should have there since I am not deploying to the target from Wappler.

So it seems Railway is also done with no-strings-attached free plans.