Answer the following questions considering the learning outcomes for this week. Make sure to record evidence of your processes. You can use code snippets, screenshots or any other material to support your answers.
Do not fill in the feedback section. The Founders and Coders team will update this with feedback on your progress.
[Learning outcome...]
- When we set up the package.json initally looked like this:
"scripts": { "start": "nodemon src/index", "format": "npx prettier --write .", "test": "node --test", },
- This meant that we would start our server locally using the command line "npm start". The "start" script in this configuration uses nodemon to automatically monitor and restart a Node.js application located in the "src/index" file whenever changes are detected.
- But when we tried to deploy the app on the fly.io the Dockerfile would try to start the machine using the same command rather the "node src/index".
- This would not allow our app to be successfully deploy and the status on the fly.io dashboard will appear as "Suspended"
[your evidence here]
![Screenshot 2023-09-19 at 14 51 02](https://private-user-images.githubusercontent.com/59057287/269888965-5e50c240-e648-4d1a-a24d-fb9664cf929f.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk1OTQyOTcsIm5iZiI6MTczOTU5Mzk5NywicGF0aCI6Ii81OTA1NzI4Ny8yNjk4ODg5NjUtNWU1MGMyNDAtZTY0OC00ZDFhLWEyNGQtZmI5NjY0Y2Y5MjlmLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjE1VDA0MzMxN1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTYyZmUyMDQyYjQxZmZkMWU3MjZlNzI5M2M4ZWQ1NWE3ZGQ3NjM1YmEyYzViZDYwODE0MDVlNTk4ZTMxM2JlY2YmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.Mn8Ibox87YBihJE2KFnObrmZgKJb7BX3QynB7VTAPCg)
![Screenshot 2023-09-19 at 14 51 40](https://private-user-images.githubusercontent.com/59057287/269888983-6bca3bc1-6f28-4100-a997-b447b238d92b.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk1OTQyOTcsIm5iZiI6MTczOTU5Mzk5NywicGF0aCI6Ii81OTA1NzI4Ny8yNjk4ODg5ODMtNmJjYTNiYzEtNmYyOC00MTAwLWE5OTctYjQ0N2IyMzhkOTJiLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjE1VDA0MzMxN1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTdhYmJkM2ZhYWNmM2UzNWUxYTlmZjYwZjAzNzQ0NThiODgwYzBmMTg1NjBlYWE2MzdjZjIyZjc5MDM0ODIyMTEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.UQRQBtDro81-6fiMmx2DsBh6DjfBRAx5IZGrtjL-8gA)
[Learning outcome...]
For this I followed this tutorial: https://fly.io/docs/app-guides/continuous-deployment-with-github-actions/ Once everything was setup and we would push a change into the main then the deployment should be automatically triggered. Unfortunately, this didn't happen the deployement got stack in an infinite loop, not GitHub actions would be triggered either. I tried to follow a different approach and set up the workflow from the GUI interface:
This solved the issue and each time there was a new change to the main branch the deployment happened automatically.
name: Fly Deploy
on:
push:
branches:
- main
jobs:
deploy:
name: Deploy app
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: superfly/flyctl-actions/setup-flyctl@master
- run: flyctl deploy --remote-only
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
Beth
Well done for finding an alternative solution using the GUI. It is a great skill to adapt your approach, particularly when under such a tight deadline ⏰
There are some ‘industry standards’ when it comes to scripts. This article outlines the difference between dev and build scripts: medium.com ☄️
Elena
Thanks Beth for sharing the article with me. Really useful and informative!