Hello, everyone! This is my first post on my new personal website. I plan to use it as a space to share some ideas and also tutorials on topics I find interesting.
This time, I'll talk about the deployment process of this website, from registering the domain to putting it into production. And if you're a university student, you can do all of this for free!
The first three sections of this post involve tips on how to request access to tools that are part of the GitHub Student Pack. If you're not interested, feel free to skip these steps.
How to request the GitHub Student Pack (GSP)
- Click this link
- Log in with your GitHub account
- You will need to submit a document that proves you are enrolled at a university
- The verification process takes a few days. For me, it took about 2-3 days
Once approved, you'll have access to a wide range of free tools and resources, like Jetbrains IDEs (including Rubymine), 1 year of access to GoRails, and more.
How to register a domain
There are several domain "Registrars," such as GoDaddy and Registro.br. Choose the one that suits you best. The registration process is simple. My choice was based on price (or lack thereof), as the GSP provides access to three free options for one year:
I chose .TECH. So, the rest of this post will use .TECH as an example.
An important factor in your choice might be the domain renewal price. Stay alert!
Requesting a domain is super simple: just click the link above, choose a domain, log in with your GitHub account or create a new account on the site if prompted, and you’re all set.
How to request 2 years of Heroku
Another great tool provided by the GSP is Heroku. You get $13 per month for 24 months, which grants you access to an Eco Dynos Plan, a Mini Heroku Postgres, and a Mini Heroku Data for Redis, totaling exactly $13.
To request:
- Click the link
- Go to the registration page
- You'll need to register a credit card
- Then wait for the review period. For me, it took about 12 hours
About my application
This site was developed using esbuild, Tailwind CSS, and PostgreSQL. The versions used are:
Ruby 3.3.2
Rails 7.1.3.4
Node.js 20.14.0
Yarn 1.22.22
psql 16.3
#por curiosidade Ubuntu 24.04
Deploying the site
Creating a Procfile
If your project was generated using esbuild, you’ll notice there’s a file called Procfile.dev. We will create a similar file. This file should be named Procfile, with no extensions, and it should be located at the root of your project. It defines the commands that will be executed when starting your application.
1. In the root folder of your project, create a file named Procfile.
Lembrando que ele precisa começar com letra maiúscula e não possui extensão.
2. In the `Procfile`, define how to start your server process:
web: bundle exec puma -C config/puma.rb
release: bin/rake db:migrate
3. Download the
Heroku CLI. If you are using Ubuntu, run the following command:
curl https://cli-assets.heroku.com/install-ubuntu.sh | sh
4. Verify that it was installed correctly by running the command:
heroku --version
5. Then run:
heroku login
6. Now we will actually start the deployment. If your Heroku account is properly set up, run:
heroku create
If there are any errors, go to your Heroku dashboard and subscribe to the Eco plan.
7. Add PostgreSQL:
heroku addons:create heroku-postgresql:essential-0
8. Add Ruby:
heroku buildpacks:add --index 1 heroku/ruby
9. Add Nodejs
heroku buildpacks:add --index 2 heroku/nodejs
10. Commit your changes and push them to the Heroku repository on GitHub:
git commit -m 'Setup commit'
git push heroku main
All set! Now you can access your application. Type heroku open in your terminal.
To access the console, type heroku run rails console.
If you change the name of your project on Heroku, you'll need to use the -a tag with the updated name to perform operations. For example: heroku run rails console -a new_name.
Configuring the GitHub repository on Heroku
- Go to your app's page on Heroku.
- Click on the Deploy tab.
- In the "Deployment method" section, click on GitHub and sync your repository.
That's it! Now you have automatic deployment for all the changes you push to your GitHub repository in the defined branch.
Configuring Your Custom Domain
- Access your app's page on Heroku.
- Click on Settings.
- Find Domains and click on Add Domain.
- Enter www.yourdomain, for example, in my case: www.jcoutinho.tech, and click to proceed.
- Copy the DNS target code.
- Access your domain provider platform, in my case, TECH.
- Go to the DNS settings.
- Click on CNAME, then Add a Record, and fill it out as follows:
- Hostname: www
- Value: Select the second option and paste the DNS TARGET code
- TTL: 7200
- Click on Save.
That’s it! Now your domain is configured. It may take a few minutes to start working, so don’t worry.
Conclusion
Well, everyone, I hope this post has been helpful and has assisted you. If you have any questions, feel free to reach out to me on social media; the links are in the sidebar. See you next time!