Skip to content

Commit

Permalink
Merge branch 'release/0.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Dunn committed Jan 26, 2017
2 parents 8a5c691 + 3e3750d commit 2077a5b
Show file tree
Hide file tree
Showing 25 changed files with 691 additions and 71 deletions.
3 changes: 3 additions & 0 deletions .gitattributes
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
16 changes: 16 additions & 0 deletions .travis.yml
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
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
[![Build Status](https://travis-ci.org/MangoTheCat/rcloud-gist-services.svg?branch=master)](https://travis-ci.org/MangoTheCat/rcloud-gist-services)

# RCloud Gist Service



## Overview

The RCloud Gist Service is a Java based service for enabling gist access to various different backend storage systems.
Expand Down Expand Up @@ -31,6 +35,10 @@ There are two mechanisms to load the project into the Eclipse IDE:
1. Use the Eclipse gradle plugin [BuildShip](https://github.com/eclipse/buildship), this is an Eclipse plugin that understands gradle projects. BuildShip does not include syntax highlighting editor, you will have to install Groovy Eclipse plugin.
2. Use the gradle eclipse plugin (this is a plugin in the gradle build file that will generate the appropriate eclipse project). To generate the eclipse files run the following `gradlew eclipse`, you can then import the project in as an existing project. When you add a new dependency in you will need to run this again to regenerate the eclipse project files and then refresh the project in eclipse and it will pick up the new settings. If you want to just generate the eclipse files for a specific sub module then run the command `gradlew :store:eclipse` for the store sub project.


## Vagrant
The Vagrantfile sets up 80% of the environment needed to run rcloud. It takes a long time to finish the provisioning. Once done rcloud will be in `/opt/rcloud/rcloud-1.7/` you will need to setup the `rcloud.conf` file and then call `sudo ./scrtips/fresh_start.sh`. The `bootstrapR.sh` has already been called as part of the provisioning.

## Components

## LICENSE & Copyright
122 changes: 122 additions & 0 deletions Vagrantfile
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
37 changes: 5 additions & 32 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ allprojects {
}
group = 'com.mangosolutions.rcloud'
project.version = scmVersion.version

ext.projectUrl = "https://github.com/MangoTheCat/rcloud-gist-services"
}

subprojects {
Expand Down Expand Up @@ -110,15 +110,6 @@ configure(subprojects.findAll {it.name =~ /.*service/}) {
buildInfo()
}

ext.installPath='/opt/' + archivesBaseName
ext.jarPath=installPath + '/' + archivesBaseName + '-' + scmVersion.version + '.jar'
ext.initPath='/etc/init.d/' + archivesBaseName
project.description = "TBD"
ext.projectVendor = "TBD"
ext.projectUrl = "TBD"
ext.projectPackageGroup = "TBD"
ext.buildId = new Date().format('yyyyMMddHHmmss')

dependencies {
compile("org.springframework.boot:spring-boot-starter-undertow:1.4.3.RELEASE")
}
Expand All @@ -131,31 +122,13 @@ configure(subprojects.findAll {it.name =~ /.*service/}) {
archives buildRpm
}

/*
ospackage {
packageName = archivesBaseName
version = project.version.replaceAll("-", ".")
release = 1
arch = NOARCH
os = LINUX
user = "prov"
group = "prov"
into installPath
task distRpm(type: Rpm, dependsOn: bootRepackage) {}

from(jar.outputs.files) {
fileMode 0500
}
task distDeb(type: Deb, dependsOn: bootRepackage) {}

link(initPath, jarPath)
}
*/

task distRpm(type: Rpm, dependsOn: bootRepackage) {

}
assemble.dependsOn distRpm

assemble.dependsOn distDeb


}
Empty file modified gradlew
100644 → 100755
Empty file.
72 changes: 71 additions & 1 deletion rcloud-gist-service/README.md
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 &#124; 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.
Loading

0 comments on commit 2077a5b

Please sign in to comment.