20

A lightweight service that will build and store your go projects binaries, Integ...

 4 years ago
source link: https://www.tuicool.com/articles/YBNVNnz
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Rabbit

A lightweight service that will build and store your go projects binaries.

Rabbit is a lightweight service that will build and store your go projects binaries. Once a VCS system (github or bitbucket) notifies rabbit of a new release, it clones the project, builds different binaries and publish them.

Ubaqeu3.png!web

Screenshot

aMJbInm.png!web

Documentation

Development:

Rabbit uses Go Modules to manage dependencies. First Create a prod config file.

$ git clone https://github.com/Clivern/Rabbit.git
$ cp config.dist.yml config.prod.yml

Then add your configs

# General App Configs
app:
    # Env mode (dev or prod)
    mode: dev
    # HTTP port
    port: 8080
    # App URL
    domain: http://127.0.0.1:8080
    # TLS configs
    tls:
        status: off
        pemPath: cert/server.pem
        keyPath: cert/server.key

# Redis Configs
redis:
    addr: localhost:6379
    password:
    db: 0

# Message Broker Configs
broker:
    # Broker driver (native or redis)
    driver: native
    # Native driver configs
    native:
        # Queue max capacity
        capacity: 50
        # Number of concurrent workers
        workers: 1
    # Redis configs
    redis:
        channel: rabbit

# Log configs
log:
    # Log level, it can be debug, info, warn, error, panic, fatal
    level: debug
    # output can be stdout or abs path to log file /var/logs/rabbit.log
    output: stdout
    # Format can be json or text
    format: json

# Release configs
releases:
    # Releases absolute path
    path: /app/var/releases
    name: "[.Tag]"

# Build configs
build:
    # Build absolute path
    path: /app/var/build
    parallelism: 1

# Application Database
database:
    # Database driver (redis)
    driver: redis
    # Redis
    redis:
        hash_prefix: rabbit_

# Third Party API Integration
integrations:
    # Github Configs
    github:
        # Webhook Secret (From Repo settings page > Webhooks)
        webhook_secret: Pz2ufk7r5BTjnkOo
        # whether to use ssh or https to clone
        clone_with: https

And then run the application.

$ go build rabbit.go
$ ./rabbit

// OR

$ go run rabbit.go

// To Provide a custom config file
$ ./rabbit -config=/custom/path/config.prod.yml
$ go run rabbit.go -config=/custom/path/config.prod.yml

Deployment

Rabbit needs a decent resources to be able to work properly. Because the build process itself done by goreleaser and it consumes a lot. So better to keep build.parallelism equal 1 and increase if you have more resources and would like to speed the build process.

On a Linux Server

Make sure you have git , golang 1.12 and goreleaser installed, and make goreleaser executable from everywhere.

# To download the latest goreleaser binary for linux (https://github.com/goreleaser/goreleaser/releases)
$ curl -sL https://github.com/goreleaser/goreleaser/releases/download/v0.108.0/goreleaser_Linux_x86_64.tar.gz | tar xz

Also make sure you are able to clone all your repositories in a non-interactive way. Just configure ssh-key and add the remote VCS to your known hosts.

Then download the latest Rabbit binary.

$ curl -sL https://github.com/Clivern/Rabbit/releases/download/x.x.x/rabbit_x.x.x_OS.tar.gz | tar xz

Create your config file as explained before on development part and run rabbit with systemd or anything else you prefer.

$ ./rabbit -config=/custom/path/config.prod.yml

On Docker

Running rabbit with docker-compose is pretty straightforward.

$ git clone https://github.com/Clivern/Rabbit.git
$ cd Rabbit/deployments/docker-compose
$ docker-compose build
$ docker-compose up -d

Docker will mount you host server ~/.ssh directory in order to be able to clone repositories that need ssh key. Please make sure it has the right permissions and also remote VCS added to known hosts. otherwise rabbit will stuck on git interactive clone.

Versioning

For transparency into our release cycle and in striving to maintain backward compatibility, Rabbit is maintained under the Semantic Versioning guidelines and release process is predictable and business-friendly.

See the Releases section of our GitHub project for changelogs for each release version of Rabbit. It contains summaries of the most noteworthy changes made in each release.

Bug tracker

If you have any suggestions, bug reports, or annoyances please report them to our issue tracker at https://github.com/clivern/rabbit/issues

Security Issues

If you discover a security vulnerability within Rabbit, please send an email to [email protected]

Contributing

We are an open source, community-driven project so please feel free to join us. see the contributing guidelines for more details.

License

© 2019, Clivern. Released under MIT License .

Rabbitis authored and maintained by @Clivern .


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK