GithubHelp home page GithubHelp logo

gogs-drone's Introduction

Gogs Drone

This repository contains everything you need to deploy a gogs server with the fully functional drone continuous integration platform.

Introduction

Gogs (or the fork Gitea) is a webbased git frontend. It's written in GO and compiles to a single small binary you can run everywhere. While GitHub or GitLab have more features, Gogs is easier to setup and runs very fast, even on small machines like a RasperryPi. Gogs does not have an continuous integration platform like GitLab with GitLabCI, but you can use Drone, it's fully based on Docker, written in Go and very easy to setup.

Goals

  • We will install Gogs not as a docker servcie, it should run on bare metall as a systemd service, because we want 22 as our default ssh port on our host machine.

  • Everything should have nice URLs, not like http://126.12.21.43:7889. So we're using Caddy to proxy pass our services internally. Letsencrypt certs are generated and updated automatically. You will need a wildcard domain for this, but you can skip corresponding chapters if you have none.

  • Drone runs and executes builds from and with Docker.

  • Everything should be maintainable, so we're using the docker-compose infrastructure.

Dependencies

  • Git must be installed. On debian-based machines do a apt-get install git.

  • Gogs stores data in a Sqlite database. On debian-based machines do a apt-get install sqlite3.

  • This setup heavily relies on the use of Docker and Compose. Please install both according to their documentation (Docker, Compose).

Instructions

After this set of instructions we've created:

  • two users:
    • caddy in /home/caddy for the http server
    • git in /home/git for Gogs and Git
  • two systemd services:
    • /etc/systemd/system/gogs.service
    • /etc/systemd/system/caddy.service
  • one configuration file:
    • /etc/caddy/Caddyfile

Log into your server and download or git clone this repository.

Caddy HTTP Server

To have nice URL's and automatic TLS you can use Caddy. If you have no domain or another HTTP Server you can skip this paragraph.

# install caddy
curl https://getcaddy.com | bash

# add user caddy and create /home/caddy
useradd -m caddy

# edit Caddyfile, change to your hostname
vi Caddyfile

# copy the Caddyfile to /etc/caddy
sudp cp Caddyfile /etc/caddy

# copy that init file to systemd's services folder
sudo cp ./caddy.service /etc/systemd/system

# give execution rights
sudo chmod 664 /etc/systemd/system/caddy.service

# enable and start that service
systemctl enable caddy.service
systemctl start caddy.service

Gogs

# add a user and create /home/git
useradd -m git

# change to that user
su git && cd ~

# clone this repo
git clone https://github.com/janstuemmel/gogs-drone.git .

# edit hostname twice in gogs/custom/conf/app.ini
vi gogs/costum/conf/app.ini

# download gogs binary (maybe change link to a newer version)
wget https://dl.gogs.io/0.11.29/linux_386.tar.gz
tar -xzf *tar.gz
rm *tar.gz

# change to your normal user
exit

After this, the gogs.service file must be copied into systemd's system directory, after that start the service.

sudo cp ./home/git/caddy.service /etc/systemd/system
sudo chmod 664 /etc/systemd/system/caddy.service

# enable and start that service
systemctl enable gogs.service
systemctl start gogs.service

Drone

Drone will run and execute from Docker. I normally run Docker from my default username, but it's also nice to run it inside a user named docker.

cd ~/gogs-drone

# change localhost to your hostname in docker-compose.yml
# generate a secret via `echo $RANDOM | sha1sum`
# and replace it with INSERT_A_SECRET_STRING
vi docker-compose.yml

# start image in detached mode
docker-compose up -d

gogs-drone's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.