-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
25 changed files
with
691 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
gradlew text eol=lf | ||
*.sh text eol=lf | ||
*.conf text eol=lf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
language: java | ||
jdk: | ||
- oraclejdk7 | ||
deploy: | ||
provider: releases | ||
api_key: | ||
secure: HYh0fPSByuuJB/r7YKc+iHRBzo13lScGz1Kign/Uj3GnAcDL+NpnYCvEl1JCymd+v8vPyFDxWmFJ6mJSyAlQzhxIRoeHpOQhECVJXuuB9IUk+o2hb+MhUuPpOwGtlUDW2Rry9qnz73fX5boEBzrYHF3vwbbqdfqc+sugkPcPJubtwlsH49CWHA0kMila/esZyuB7KvXuEmVCy3BCHBPK9KZ9Wo8LlB3pQhUwJWkSJID5BJl/zYDqOrKo4kjXpu6p5xcwAi+HtpCmV3gAMgcHPTO8sXy2b9JKcko0C52/+nyHpQ39gmwS0y+q0lnGZJy38IF52JDzXLAq1DxIXm2hPvI/zMNlhYJ6ovCuT7xTXypKnktwetQJ5dT6hvtNmtBMxkXww43svAb/k9nr2bo9z65iOqKpqdFQYzFB/wltToMbX50xC9Yi+fYv219H3Fc6vioJw5bkRCoapC7ImmkhVjsv5YDEGbqv3dyEbGOWyI0phnJBd6+UjMFCSxX9pinu+RUhLU0uga9/765kiMYsQAH7svzyo5iYcN0HB4X1amAKjaLmp2so2AqKk4FKznVHhtY0Mm74Xgq6tmQTk7iuCwbvf2M1pCjhV4zDBio2XODHGGxJeIZAQTx0CIXz0F20o6K9XC2vDM6BWHt2YCN6qjR0buYP/NdsOPcjeSnCVMk= | ||
file_glob: true | ||
file: | ||
- "./rcloud-gist-service/build/distributions/*.deb" | ||
- "./rcloud-gist-service/build/distributions/*.rpm" | ||
- "./rcloud-gist-service/build/libs/*.jar" | ||
skip_cleanup: true | ||
on: | ||
repo: MangoTheCat/rcloud-gist-services | ||
tags: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
# -*- mode: ruby -*- | ||
# vi: set ft=ruby : | ||
|
||
# All Vagrant configuration is done below. The "2" in Vagrant.configure | ||
# configures the configuration version (we support older styles for | ||
# backwards compatibility). Please don't change it unless you know what | ||
# you're doing. | ||
Vagrant.configure(2) do |config| | ||
# The most common configuration options are documented and commented below. | ||
# For a complete reference, please see the online documentation at | ||
# https://docs.vagrantup.com. | ||
|
||
# Every Vagrant development environment requires a box. You can search for | ||
# boxes at https://atlas.hashicorp.com/search. | ||
#config.vm.box = "ubuntu/trusty64" | ||
config.vm.box = "janihur/ubuntu-1404-desktop" | ||
|
||
|
||
config.vm.hostname = "rcloud.local" | ||
|
||
# Disable automatic box update checking. If you disable this, then | ||
# boxes will only be checked for updates when the user runs | ||
# `vagrant box outdated`. This is not recommended. | ||
# config.vm.box_check_update = false | ||
|
||
# Create a forwarded port mapping which allows access to a specific port | ||
# within the machine from a port on the host machine. In the example below, | ||
# accessing "localhost:8080" will access port 80 on the guest machine. | ||
config.vm.network "forwarded_port", guest: 80, host: 80 | ||
config.vm.network "forwarded_port", guest: 13010, host: 13110 | ||
config.vm.network "forwarded_port", guest: 13011, host: 13111 | ||
|
||
#config.ssh.forward_agent = true | ||
|
||
|
||
# Create a private network, which allows host-only access to the machine | ||
# using a specific IP. | ||
# config.vm.network "private_network", ip: "192.168.33.10" | ||
config.vm.network "private_network", type: "dhcp" | ||
|
||
# Need to manage the hosts file to add in the real ip address, using | ||
# vagrant-hostmanager for this: | ||
# (https://github.com/devopsgroup-io/vagrant-hostmanager) | ||
# To install run vagrant plugin install vagrant-hostmanager | ||
config.hostmanager.enabled = true | ||
config.hostmanager.manage_host = true | ||
config.hostmanager.manage_guest = true | ||
config.hostmanager.ignore_private_ip = false | ||
config.hostmanager.include_offline = true | ||
config.hostmanager.ip_resolver = proc do |vm, resolving_vm| | ||
if hostname = (vm.ssh_info && vm.ssh_info[:host]) | ||
`vagrant ssh -c "hostname -I"`.split()[1] | ||
end | ||
end | ||
|
||
# Create a public network, which generally matched to bridged network. | ||
# Bridged networks make the machine appear as another physical device on | ||
# your network. | ||
# config.vm.network "public_network" | ||
|
||
# Share an additional folder to the guest VM. The first argument is | ||
# the path on the host to the actual folder. The second argument is | ||
# the path on the guest to mount the folder. And the optional third | ||
# argument is a set of non-required options. | ||
# config.vm.synced_folder "../data", "/vagrant_data" | ||
|
||
# Provider-specific configuration so you can fine-tune various | ||
# backing providers for Vagrant. These expose provider-specific options. | ||
# Example for VirtualBox: | ||
# | ||
config.vm.provider "virtualbox" do |vb| | ||
# Display the VirtualBox GUI when booting the machine | ||
vb.gui = true | ||
# Customize the amount of memory on the VM: | ||
vb.memory = "4096" | ||
vb.cpus = "2" | ||
vb.customize ["modifyvm", :id, "--ioapic", "on"] | ||
vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"] | ||
end | ||
# | ||
# View the documentation for the provider you are using for more | ||
# information on available options. | ||
|
||
# Define a Vagrant Push strategy for pushing to Atlas. Other push strategies | ||
# such as FTP and Heroku are also available. See the documentation at | ||
# https://docs.vagrantup.com/v2/push/atlas.html for more information. | ||
# config.push.define "atlas" do |push| | ||
# push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME" | ||
# end | ||
|
||
# Adds the hostname of this machine into the hosts file | ||
config.vm.provision :shell, inline: "sed -i'' 's/^127.0.0.1\\t#{config.vm.hostname}.*$//' /etc/hosts" | ||
# Enable provisioning with a shell script. Additional provisioners such as | ||
# Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the | ||
# documentation for more information about their specific syntax and use. | ||
|
||
config.vm.provision "shell", inline: "sudo apt-get update" | ||
config.vm.provision "shell", inline: "sudo apt-get install -y curl" | ||
#config.vm.provision "shell", inline: "sudo /usr/share/debconf/fix_db.pl" | ||
#config.vm.provision "shell", inline: "sudo apt-get upgrade" | ||
#config.vm.provision "shell", inline: "sudo apt-get install -y xfce4 virtualbox-guest-dkms virtualbox-guest-utils virtualbox-guest-x11" | ||
#config.vm.provision "shell", inline: "sudo sed -i 's/allowed_users=.*$/allowed_users=anybody/' /etc/X11/Xwrapper.config" | ||
|
||
|
||
config.vm.provision "shell", inline: <<-SHELL | ||
curl -L https://bootstrap.saltstack.com | sudo sh -s -- stable | ||
SHELL | ||
|
||
config.vm.synced_folder "salt/roots/salt", "/srv/salt/" | ||
config.vm.synced_folder "salt/roots/pillar/", "/srv/pillar/" | ||
|
||
config.vm.provision :salt do |salt| | ||
salt.masterless = true | ||
salt.run_highstate = true | ||
# salt.bootstrap_options = "-F -c /tmp -P" | ||
## salt.minion_config = "salt/minion.yml" | ||
# salt.run_highstate = true | ||
# salt.colorize = true | ||
# salt.log_level = 'debug' | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,71 @@ | ||
# Implementation of the RCLoud Gist Service. | ||
# Implementation of the RCloud Gist Service. | ||
A Java based service to provide GitHub gist functionality to RCloud. | ||
|
||
## Building | ||
The code uses the Gradle build system and includes the gradle wrapper in the root | ||
of the project. The only requirement for building is a Java JDK version 7 or greater | ||
and an internet connection, all dependencies will be downloaded for the build. | ||
|
||
To build the software run the following command which runs the tests and generates | ||
the artifacts. | ||
|
||
`./gradlew build` | ||
|
||
### Outputs | ||
The build generates 3 artifacts | ||
1. An executable jar file created here: `./rcloud=gist-service/build/libs` | ||
2. An rpm install file created here: `./rcloud=gist-service/build/distributions` | ||
3. An deb install file created here: `./rcloud=gist-service/build/distributions` | ||
|
||
## Installation | ||
|
||
The redhat and debian install archives will install the application to | ||
`/opt/rcloud-gist-service` and create an entry in the `/etc/init.d/` folder | ||
which can be used to start and stop the service. | ||
|
||
### User and Groups | ||
The installation creates a user and group for the service called `rcloudgistservice` which the service runs as. | ||
|
||
### Debian based systems | ||
To install the service on debian based systems the following command can be used, you will need to use the correct name for the deb file for the version you are installing. | ||
|
||
`sudo dpkg -i ./rcloud-gist-service_0.1.0-20170126123855_all.deb` | ||
|
||
## Default ports | ||
The service uses two ports, one for the gist api and the other for the service management functionality, these can be controlled in configuration. The management port is secured using basic auth. | ||
|
||
## Service Configuration | ||
|
||
Configuration is held within the `/opt/rcloud-gist-service/application.yml` file. | ||
The following parameters are configurable: | ||
|
||
| Property | Description | Default | | ||
|----------|-------------|---------| | ||
| `github.api.url` | The URL to the root of the GitHub installation that this should use | `https://api.github.com` | | ||
| `service.port` | The port that the gist api is accessible over | `13010` | | ||
| `management.port` | The port that the service management api is accessible over | `13011` | | ||
| `security.user.name` | The username that is required for basic auth access to the management port | `admin` | | ||
| `security.user.password` | The username that is required for basic auth access to the management port | If not specified the password is generated at service startup and can be identified in the `/var/log/rcloud-gist-service/rcloud-gist-service-file.log` file. The following command can be used to find the password. `cat /var/log/rcloud-gist-service/rcloud-gist-service-file.log | grep "Using default security"`. More information can be found on the [spring boot documentation.](http://docs.spring.io/spring-boot/docs/current/reference/html/production-ready-monitoring.html) | | ||
|
||
### Java Configuration | ||
The startup parameters for the JVM are stored in the conf file in the installation directory, this must have the same name as the jar file. | ||
|
||
|
||
## RCloud Configuration | ||
To configure RCloud edit the `rcloud.conf` and change the `api.github.url` value to the URL of this service if running with the defaults then this would be `http://localhost:13010` e.g. : | ||
|
||
`github.api.url: http://localhost:13010` | ||
|
||
## Starting and stopping the service | ||
|
||
An System V startup script is installed as part of the installation, thissupports the following commands: | ||
|
||
| Command | Example | | ||
|---------|--------------------------------------| | ||
| start | `service rcloud-gist-service start` | | ||
| stop | `service rcloud-gist-service stop` | | ||
| status | `service rcloud-gist-service status` | | ||
|
||
## Logging | ||
The service uses [Logback](https://logback.qos.ch/), this is controlled by the | ||
configuration file in the installation directory `/opt/rcloud-gist-service/logback.xml`, this configuration file can be updated and the changes will be reloaded to alter the log output. The service writes log files to `/var/log/rcloud-gist-service/` access to this folder is restricted to `root` group and the `rcloudgistservice` user/group. |
Oops, something went wrong.