-
Notifications
You must be signed in to change notification settings - Fork 12
LAB8_Verify and Deploy in Netlify
Objectives
In this step, we will:
- Merge our code back to master and verify production application deployment
We will cover:
- Merge back to master
- Verify your deployment in Netlify
- Feel the enormity of your accomplishment
- Super secret full game option
Now it's time to merge ALL of the changes from the last 3 sections back to master. This will kick off an automated deploy to Netlify and get our changes ready for production.
✔️ Ensure you are in the battlestax
directory before running the following commands.
📘 Commands to execute
git add functions/insertGame.js test/insertGame.test.js
git commit -m "Merging insertGame and insertGame.test.js into master"
git push
✔️ Don't forget we are still working out of the myBranch
branch
✔️ Once you've completed the push
command above go back to YOUR battlestax repository in Github and create a Pull Request to merge the changes into master. Use the same exact process we used in LAB2 to do this.
If you need a refresher go HERE to LAB2 and then come back here to finish your deployment.
✔️ When your new site is ready, you will be able to go to: <your_url>.netlify.app
to see your game. To find your URL, navigate to Deploys
in Netlify and click on the link provided via the UI.
✔️ Once clicked you should see a display like the following:
If you start new games it will create a new record in the database. If you want to validate this behavior click on START NEW GAME
.
✔️ Once you click the START NEW GAME
button you should see a display like the following:
✔️ Open Astra UI, show the CQL Console
and execute the following command (here battlestax is your keyspace and games your collection name - if you chose another names adapt the query accordingly).
📘 Command to execute
SELECT key, text_value FROM battlestax.games;
You should have a result that looks like the following image. If you see the game you just created in this list you know your application is properly hooked up to your database via the document API.
Alrighty, let's sum all this up. If you got to this point you have now...
- deployed an application through a CI/CD pipeline with GitHub Actions
- using serverless functions
- that are globally available via Netlify
- all backed by the top NoSQL distributed database Apache Cassandra on DataStax Astra
- without ever touching a server, deploying back-end code, or needing to talk to your IT folks (no harm meant to my IT friends).
Wait! I thought you said we were done!? Well, you are, but if you want to take things one step further click the drop down below.
Secret "full game" option
At this point you have a partially working app. It demonstrates what is needed for our purposes here, but if you want the absolutely completed application then you need to do the following. Be advised, executing these commands will essentially overwrite everything in the master
branch.
✔️ Ensure you are in the battlestax
directory.
📘 Commands to execute
git checkout full-game
git push -f origin full-game:master
Once completed this will cause an automatic production deployment from master. Again, Netlify is configured to react to any changes to master by default. Since we pushed right to master and skipped using a PR our changes will go right to production.
✔️ Once the deployment is complete, navigate back to Deploys
in Netlify and launch your site URL.
✔️ From there, append "/lobby" to the end of your URL. It will look something like "https://cranky-blackwell-45ee9c.netlify.app/lobby".
✔️ Finally, you can start a game by clicking the START NEW GAME
button and having your friends join by going to the same URL sans "/lobby". Add a name and the game code generated when you started the game.
Have fun :)
🏠 Home
Introduction to the JAMStack Why this is cool ? Introduction to Netlify Want to learn more ? 🛠️ II - Setup and deploy your first app
Create your BattleStax repository Setup Netlify account Summary 🛠️ III - Create your Astra instance
Register and Sign In to Astra Configure and create your database Activate Cassandra awesome 📚 IV - What can Netlify do for you
Build, Package, deploy, host Advanced features Netlify Functions Want to learn more 🛠️ V - Expose your "hello world" API
Setup your environment Make a serverless endpoint using Netlify functions Merge back to master Check your deployment in Netlify Summary 📚 VI - What are DataStax Astra and Stargate
Introduction to Astra Introduction to Stargate Want to know More 🛠️ VII - Set environment variables in your application
Creating the .env file Explore the API with HTTPie 🛠️ VIII - Set secrets in GitHub for CI/CD
Configure secrets in GitHub Verify your secrets How is this all working ? 🛠️ IX - Set environment variables in Netlify
Set environment variables in Netlify Verify your environment variables Summary 🛠️ X - Implement a CRUD Api in Astra
Creating the insertGame Netlify endpoint Connect to Astra Hook it all together Running TDD tests 🛠️ XI - Verify and Deploy in Netlify
Merge back to master Verify your deployment in Netlify Feel the enormity of your accomplishment Super secret full game option 📚 XII - Resources