Deploying a website
What is deploying a website?
Deploying, or rolling out a website, is the process of moving a website or application from the development environment to a live environment where users can access it. This means that you actually make your website available to the public. Without this step, your website will only run on your local computer and it will be of no use to anyone.
You can compare deploying with writing a book. While writing, you work in a notebook (the development environment). When you're done, print the book and put it in a library where people can read it (the live environment). Printing it and taking it to the library is comparable to deploying your website.
During deployment, you put your code live via a web hosting provider, which can be done via FTP, Git, or CI/CD tools. I use Git myself. Git is a version control system used to track changes to a project's code. It helps developers manage the history of their work and collaborate on projects without accidentally overwriting each other's work.
To explain it more clearly, imagine you are writing an important document, such as a book. Every time you finish a chapter, make a copy of the document so you have a version history. If one day you find that you've made a mistake or changed something you shouldn't have, you can roll back to an earlier version. Git does this automatically for programming code: it saves snapshots of every change you make, so you can always roll back to an earlier version.
A commonly used platform for this is GitHub, which is also what I use. Here you can create repositories. A Git repository is like a repository for your project. It contains all files, folders and the history of all changes made.
Every time you save a change to your project, you use a commit. Commits help you keep track of what has changed and why.
In Git you can create different branches or branches of your project. This means that you can have multiple versions of your project, for example to develop new features or fix bugs without affecting the main version of the project. When you have finished working on a separate branch, you can merge it into the main branch. This adds the new changes to the main version of your project.
Dutch hosting providers
Many Dutch hosters offer limited server configuration options, which can cause problems when installing certain software or frameworks. Often they only support PHP or WordPress. Finding a Dutch hosting party that supports Python code can be quite a task. And when you do find one, Git is often not supported.
This is the reason why my own website does not run via a Dutch hosting party. Fortunately, there are many foreign parties that are good and often free or cheap. I have now tested a number of them: Heroku, Vercel, and Koyeb. Currently my site is running on Railway.
An important reason why I chose Railway over Vercel and Koyeb is that the free versions of Vercel and Koyeb have a long startup time when idle. This means that your site can take several seconds to load with each new visitor, negatively impacting the user experience. I also talked about this in my Instagram post of August 29, 2024.
Moreover, the paid versions of Vercel and Koyeb are quite expensive. Railway offers a paid version that is cheaper and has a faster boot time, which makes it more attractive for my needs.
My solution with CloudFlare
All hosting parties provide you with DNS settings that you must set at your domain name host. In my case that is TransIP. With Vercel you get an IP number, which makes the settings easy to configure. However, this does not happen at Koyeb and Railway, which makes setup difficult and was difficult to realize at TransIP.
To solve this problem, I now use Cloudflare. Cloudflare is a network service that makes websites faster, more secure and more reliable. It acts as an intermediary between a website and its visitors, providing a range of features that improve website performance and security. Cloudflare monitors and secures the internet traffic going to the website and helps deliver it faster. This allowed me to easily apply Railway's DNS settings by using TransIP only for domain name registration and managing the DNS settings via Cloudflare.
Best practices annd tips
When deploying your website, there are some best practices you can follow:
- Testing: Make sure you test your code in a staging environment before going live. This helps to identify problems before your website is accessible to the public.
- Safety: Monitor your website for any security issues. Implement regular updates and security patches.
- Backups: Make regular backups of your website and database, especially before performing a deployment. This helps you recover quickly in case of problems.
If something goes wrong during a deployment, you will often see a log file in which you can track down the error and adjust it. This will help you resolve issues quickly and get your website back in top shape.
Would you like to stay informed of my latest projects and updates?
!Follow me on Instagram @hello_daphne_nl