Create a group for a system user (daemnos and program users like www-data, mysql...)
# addgroup --system jboss
Create a user (system user, without home -> See below the command, to the jboss group and no login shell)
import os | |
import subprocess | |
BAT_PATH = "/proc/acpi/battery/BAT%d" | |
def get_full_charge(batt_path): | |
"""Get the max capacity of the battery | |
:param batt_path: The dir path to the battery (acpi) processes |
package k8sunstructured_test | |
import ( | |
"bytes" | |
"testing" | |
"github.com/stretchr/testify/assert" | |
"github.com/stretchr/testify/require" | |
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | |
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" |
# -*- coding: utf-8 -*- | |
# | |
# Copyright (c) 2012, Xabier (slok) Larrakoetxea <slok69 [at] gmail [dot] com> | |
# | |
# 3 clause/New BSD license: | |
# opensource: http://www.opensource.org/licenses/BSD-3-Clause | |
# wikipedia: http://en.wikipedia.org/wiki/BSD_licenses | |
# | |
$ time vgo build | |
vgo: finding github.com/google/cadvisor v0.0.0-20170309230114-17543becf905 | |
vgo: finding gopkg.in/olivere/elastic.v2 v2.0.0-20151008152123-3cfe88295d20 | |
vgo: finding golang.org/x/oauth2 v0.0.0-20150321034511-ca8a464d23d5 | |
vgo: finding golang.org/x/net v0.0.0-20151120032300-5627bad10b82 | |
vgo: finding github.com/influxdb/influxdb v0.0.0-20151125225445-9eab56311373 | |
vgo: finding github.com/go-ini/ini v0.0.0-20160207163330-193d1ecb466b | |
vgo: finding github.com/eapache/queue v0.0.0-20150606115303-ded5959c0d4e | |
vgo: finding github.com/coreos/rkt v0.0.0-20160513154944-14437382a98e | |
FindRepo: Get https://speter.net/go/exp/math/dec/inf?go-get=1: x509: certificate signed by unknown authority |
hand := &handler.HandlerFunc{ | |
AddFunc: func(ctx context.Context, obj runtime.Object) error { | |
// Get the parent span. | |
pSpan := opentracing.SpanFromContext(ctx) | |
// Create a new span. | |
span := tracer.StartSpan("AddFunc", opentracing.ChildOf(pSpan.Context())) | |
defer span.Finish() | |
// Do stuff... |
// Initialize logger. | |
log := &log.Std{} | |
// Create the controller that will refresh every 30 seconds. | |
ctrl := controller.NewSequential(30*time.Second, hand, retr, log) | |
// Start our controller. | |
stopC := make(chan struct{}) | |
if err := ctrl.Run(stopC); err != nil { | |
log.Errorf("error running controller: %s", err) | |
os.Exit(1) | |
} |
// Our domain logic that will print every add/sync/update and delete event we . | |
hand := &handler.HandlerFunc{ | |
AddFunc: func(obj runtime.Object) error { | |
pod := obj.(*corev1.Pod) | |
log.Infof("Pod Add event: %s/%s", pod.Namespace, pod.Name) | |
return nil | |
}, | |
DeleteFunc: func(s string) error { | |
log.Infof("Pod Delete event: %s", s) | |
return nil |
// Create our retriever so the controller knows how to get/listen for pod events. | |
retr := &retrieve.Resource{ | |
Object: &corev1.Pod{}, | |
ListerWatcher: &cache.ListWatch{ | |
ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { | |
return k8scli.CoreV1().Pods("").List(options) | |
}, | |
WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { | |
return k8scli.CoreV1().Pods("").Watch(options) | |
}, |
#!/bin/bash | |
echo -e "\e[1;33mAdd multiverse repo\e[0m" | |
sudo add-apt-repository multiverse | |
sudo apt-get update | |
echo -e "\e[1;33mInstall common dependencies\e[0m" | |
sudo apt-get install python python-pip python-dev git ruby ruby-dev build-essential | |
echo -e "\e[1;33mInstall virtualbox\e[0m" |