Learned about Linux through a Flask project on the VPS, bash automation scripting, Test-Driven Development, Docker containerization, CI/CD pipelines through Github Actions, troubleshooting and monitoring using Prometheus and Grafana. The goal of the internship was to gain a comprehensive understanding of system reliability, scalability, and performance.
Deploy their Flask app on a remote instance (doesn’t stay hosted when they close their terminal)
- Create Digital Ocean VPS CentOS Stream 8, Basic Regular Intel with SSD 1GB / 1 CPU / 25GB Disk
- Authentication: SSH keys
- Install git & python3 installed
- Install python virtual environment
- Run Flask Application
- Get Your Free Subdomain with DuckDNS
- Keep Flask App Running with Tmux
Set up your VPS instances in the cloud and chain together a load of the steps using scripting. Used scripting to speed up workflows and automate parts of the process.
- Automate Deployment with Bash Scripting
Deployed the project as a service, meaning your website will continue to be hosted when disconnected from the VPS.
- Creating Service
- Install a MySQL Database Server
- Create Save and Retrieval Endpoints
- Create Timeline Post Page
Testing the changes to prevent bugs making their way into production. These tests will be used in future weeks to combine it with CI/CD.
Database Testing
- Flask Application Testing
“Containerise” the project in its current state, and then isolating different components out. Write configuration files, such as Dockerfile and Docker Compose
- Setting up Docker
- Test Docker Installation
- Container Orchestration
- Set Up Nginx and HTTPS
Build tests into continuous integration systems to check new changes automatically on GitHub, using GitHub Actions. Once tests are running automatically, deploy your containers automatically to the VPS. Wrote YAML and build GitHub Actions.
- GitHub Actions - Tests
- GitHub Actions Deploy to DigitalOcean
Monitor linux processes and memory usage and add monitoring systems into your projects, such as Prometheus and Grafana.
- I/O Monitoring and Disk Bottlenecks
- Setup Grafana Dashboards
Make sure you have python3 and pip installed
Create and activate virtual environment using virtualenv
$ python -m venv python3-virtualenv
$ source python3-virtualenv/bin/activate
Use the package manager pip to install all dependencies!
pip install -r requirements.txt
Create a .env file using the example.env template (make a copy using the variables inside of the template)
Start flask development server
$ export FLASK_ENV=development
$ flask run
You should get a response like this in the terminal:
❯ flask run
* Environment: development
* Debug mode: on
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
You'll now be able to access the website at localhost:5000
or 127.0.0.1:5000
in the browser!
Note: The portfolio site will only work on your local machine while you have it running inside of your terminal. We'll go through how to host it in the cloud in the next few weeks!
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.