# Drone, Gitea, Ngnix, Lets Encrypt *This repos was forked from github user [cnbattle](https://github.com/cnbattle/drone-gitea)* I was inspired to host my own "gitlab/github clone" on my own hardware with docker. This stack has most everything needed for someone to host something from their own box running docker. Each docker service defined in the `docker-compose.yml` file has a specific job to do. - Gitea: the git remote host (think github clone) - Drone: Ci server / runner - Nginx-proxy: reverse proxy for using one docker host while routing to many domain names. - Letsencrypt companion: handles the renewal of ssl certs automagicaly! ## Lets get started! To get started clone down this repository. Observe the contents of `example.env`, this file is an example of the main configuration file for the docker hosts. Each of these fields is required and may include differences in configuration depnding on the ending configuration. As writen `example.env` assumes that one would like to use every possible option. Each section corisponds to the assciated `docker-compose` directive. ``` #LetsEncrypt LETSENCRYPT_DEFAULT_EMAIL=youremail@example.com #Gitea Server GITEA_HOST=gitea.example.com #Drone Server DRONE_GITEA_SERVER=https://gitea.example.com DRONE_GITEA_CLIENT_ID=da1cdbdd-a50d-4367-80d9-a8fdff8c652f #Oauth application id from gitea DRONE_GITEA_CLIENT_SECRET=ftJDp0UdFgutif7K3XuFYZKAXCLaHZxKA-psdyS_LkE= #Oauth application secret DRONE_RPC_SECRET=a1cf994eee95899f31f296c25d8310f0 #Generated drone RPC secret DRONE_SERVER_HOST=drone.example.com DRONE_SERVER_PROTO=https #Drone Runner DRONE_RPC_PROTO=http DRONE_RPC_HOST=drone.example.com:8000 #Set this to the box host to bypass the proxy DRONE_RUNNER_CAPACITY=2 DRONE_RUNNER_NAME=drone-runner ``` In order to configure drone we must run the cluster without drone Oauth configuration so start up with: ``` docker-compose up -d ``` Notice that `DRONE_GITEA_CLIENT_ID` and `DRONE_GITEACLIENT_SECRET` will be need to be filled in after createing a Oauth application in gitea. Drone has documentaion [here](https://docs.drone.io/server/provider/gitea/). Follow the tutorial and edit the file with the correct values then restart the services. DONT FORGET TO SAVE! ``` docker-compose down && docker-compose up -d ``` That should do it, you now have a running remote repo / Ci! Happy codeing! ## Trouble Shooting Althought this configuration should work for most people there are some gotchas that may trip some people up. ## Requirments - A publicly reachable host on port 80 and 443, required by letsencrypt - A Domain that is controled by a a DNS provider that supports DNSSEC, required by letsencrypt - A docker host that can expose port 80 and 443 on the host, ngnx-proxy - Unique dns sub domains for Drone and gitea. ## Help, It wont work with my configuration! *Dont panic ! Remember the hitch hikers guide!* This configuration may not meet the needs of people on networks that do not suport the above. Feel free to fork and hack away if that's the case ! If something just isn't lineing up drop us a Issue! We are happy to help!