This project is inspired by Reddit and was developed solely for learning programming. It is not an official product and has no connection, affiliation or sponsorship from Reddit.
Last deployment: Version: 1.0.1
.NET Playground
This is a personal project for experimenting with and studying ASP.NET Core and .NET application infrastructure on Linux/AWS.
The project runs on AWS EC2 and currently explores:
- C# / ASP.NET Core — web application
- Nginx — reverse proxy and load balancing
- systemd — instance management on ports 5000 and 5001
- Docker — running the instance on port 5010
- AWS EC2 — hosting environment
- CI/CD with Jenkins
Architecture
There are currently three application instances running on EC2:
| Component | Port | Runtime |
|---|---|---|
| Nginx | 80 |
Reverse proxy and load balancing |
| ASP.NET server A | 5000 |
systemd |
| ASP.NET server B | 5001 |
systemd |
| ASP.NET server C | 5010 |
Docker |
The first two instances run directly on Linux and are managed by systemd.
The third instance runs inside a Docker container. Docker is part of the playground to experiment with containerizing an ASP.NET Core application and compare that approach with running via systemd.
Nginx acts as a reverse proxy and allows experimenting with load balancing across multiple application instances.
The applications on ports 5000, 5001 and 5010 are independent instances of the same project.
Your page was served by: Servidor B. Port: 5001
To check whether your request is served by another application instance.
This page uses cookie authentication and anti-forgery tokens.
Jenkins and CI/CD
The project has a pipeline in Jenkins to automate building, testing and deploying .NET Playground on AWS EC2. The workflow connects the code on GitHub to the ASP.NET Core application running on Linux.
Jenkins on a personal computer
The Jenkins server runs on the developer's personal computer, under a dedicated Windows account. Jenkins starts automatically when that user logs in, preparing the environment to run the pipeline.
GitHub webhook with ngrok
The ngrok exposes a public endpoint that forwards requests to Jenkins on the personal computer. This address is configured as a webhook in the GitHub repository: when a push occurs, GitHub sends a notification through the ngrok tunnel and Jenkins can start the pipeline.
Continuous integration (CI)
The pipeline uses the githubPush() trigger to receive GitHub push events and organizes code validation into three stages:
- Checkout: fetches the
masterbranch from the repository into the Jenkins workspace, using a stored GitHub credential. - Build: restores dependencies with
dotnet restoreand builds the solution inReleasewithdotnet build --no-restore. - Test: runs the
WebApplication1.Testswithdotnet test --configuration Release --no-build, reusing the previous build.
A build or test failure stops the pipeline before deployment.
Deployment to EC2 (CD)
In the CD stage, Jenkins publishes the application and packages the files into a ZIP archive. Using the SSH credential loaded by sshagent, it transfers the package to EC2 over SCP. It then connects to the server over SSH, extracts the files into the application directory, and restarts the systemd services and Docker container.
Workflow: GitHub (push and webhook) ngrok Jenkins on the personal computer (checkout, build, tests and ZIP publishing) SCP (package transfer to EC2) SSH (connection to EC2) file extraction restart of the systemd services and Docker container
Because the script stops services during the process, this strategy may cause brief downtime during deployment.