# Back-end technical writer assessment

## Proposed tutorial series: Setting up a web application with CI/CD with Gitea and Drone

Gitea is a self-hosted git service for managing repositories and users. Drone is a self-hosted continuous integration (CI) service that allows one to automate software build and testing. It works well with Gitea to automate testing, building, and deploying code as it moves through the development life-cycle.

### Justification

By being self-hosted, both Gitea and Drone are attractive options to users with privacy concerns or those who want total control over their CI/CD process, and by being FOSS, it appeals to users who are interested in supporting open source software or who are on a budget --- notably, Gitea is a much lighter-weight option than Gitlab for self-hosted git services and can be run on a small Droplet (it is available as a 1-Click App).

The tutorial series is of medium complexity for someone with dev experience, requiring familiarity with installing software on a Linux server (one must install Docker in order to install Drone), familiarity with the command line (setting up Gitea and Drone require a few commands, and setting up Systemd services a few more), and software such as Nginx and SSH. The strategy for teaching the topic through the tutorial would be to break it up into easily digestible chunks that will offer a chance to play with each of the bits of technology. Additionally, each section of the tutorial will be able to stand alone on its own ( Parts of the tutorial would be expanding on information offered by the installation instructions by Gitea and Drone, but only inasmuch as that's needed for customizing them to the purpose at hand; being able to offer links to to existing resources will help clarify for the developer.

### Tutorials

1. Installing Gitea:
    
    By the end of the tutorial, the user will have an instance of Gitea running on a droplet behind an Nginx reverseproxy. It will be controlled as a Systemd service and ready to use for hosting code. Gitea instance created by this step: <https://gitea.do-assess.makyo.dev/>
    
    1. Download Gitea binary and set up system to run it as 'git' user
    3. Set up Nginx reverseproxy to host it
    4. Set up Gitea with Systemd per instructions
    5. Create a repo for your app
    
2. Installing Drone to work with Gitea:

    By the end of the tutorial, the user will have an instance of Drone running and connected to Gitea that will be able to build and test applications as the user works on them. Drone instance created by this step: <https://drone.do-assess.makyo.dev>
    
    1. Install docker
    2. Download Drone
    3. Set up Nginx reverseproxy
    4. Integrate Drone and Gitea
    5. Set up project in Drone
    
3. Setting up CI/CD with Drone and Gitea:
    
    By the end of the tutorial, the user will have an application that is continuously tested and deployed to a server to be accessed by the public.
    
    Successful docker runner build: <https://drone.do-assess.makyo.dev/makyo/test-flask/25>
    
    1. Set up Drone docker runner for testing
    2. Set up Drone exec runner for deployment
    
4. Setting up deployment strategies with Drone and Gitea:

    By the end of the tutorial, the user will have an application set up in three environments --- sandbox, staging, and production --- that are managed through Drone. This will be offered in two very closely paths: using `when` clauses in the steps to deploy to different environments, and using Drone's concept of promotion to manually promote builds to environments.
    
    Successful deploys at: <https://sandbox.do-assess.makyo.dev> <https://staging.do-assess.makyo.dev> <https://sandbox.do-assess.makyo.dev>
    
    1. Set up pipeline steps for e.g: sandbox, staging, prod
    2. Set up Nginx to serve each target
    3. Using branch limits:
        1. Merge each branch into main when it lands
        2. Promote sandbox to staging for testing by merging main into staging branch
        3. Promote staging to prod by merging staging into prod
    4. Using promotion:
        1. Work against e.g: main branch
        2. Promote successful build to desired target using the drone CLI (`drone build promote test-flask 25 production`)
