Now it's time to do the final deployment configuration to make this application work in production. So first things First, go inside of your railway service, go inside of settings and find public networking. If you haven't already, go ahead and generate a domain. If it asks you for a port, put 8080. That should generate you a domain.
Now the domain should work as expected with one big problem and that is that every time you try to run a workflow, it will never actually execute it and instead it will simply stay as queued. So go ahead and try and running any workflow. You will see that I can't even stop a workflow, right? So obviously something is not working right. What we have to do is we have to follow trigger.dev deployment instructions.
You can find that under the deployment section and click on the overview. So first, let's go ahead and run the deploy command within our code base. This deployment will probably fail with errors like these, missing API keys. Right now, what we have to do is we have to transfer all of our environment variables which are used within our long running tasks into the Trigger Cloud Platform. So let's go ahead and copy this entire file, environment.local.
And then let's go inside of our trigger dashboard. In here you will find the environment variables and go ahead and click add new. You can see that there's a tip. Paste all of your environment variables at once into this form to populate it. There we go.
Not all of these are needed but it's a quick and easy way to add all the ones that you need. So then go ahead and mark this both as development and production. Obviously, you should have different variables for both of those, but since it's just easier to demonstrate how to go to production this way, I'm going to use the same variables for both. And then I'm going to hit save. Once you have all of your environment variables stored, go ahead and try running trigger deploy again.
Now you should have a successful deployment. So go inside of your trigger dashboard and make sure that you switch your environment to production. Once you are in production, go ahead and scroll down until you find API keys and you should see a big label production API keys. Now go ahead and copy this API key and the place where you're going to add this is in your deployment service. So not here.
Do not change the development secret key. This needs to stay as the development environment, but instead you need to change one variable inside of your raw editor here. So go ahead and find the trigger secret key and replace it with a production one. Click update variables and deploy. Once you have a successful redeployment, go ahead and refresh your live URL and then attempt to run the app again.
And this time you should see live feedback and actual execution happening. And if you go inside of your trigger dashboard in the tasks or runs you should also see your first production run being executed. Amazing, amazing job and congratulations on your official deployment of this project.