Skip to content
Permalink
Browse files
Merge remote-tracking branch 'jclouds-labs-profitbricks-local/promote…
…-profitbricks-moved' into promoted-profitbricks
  • Loading branch information
devcsrj committed Feb 19, 2016
2 parents e0ab5d8 + 7202e05 commit 1af52159c9e0edca03ecfcbad3a1f0d0957cc335
Show file tree
Hide file tree
Showing 260 changed files with 20,011 additions and 0 deletions.
@@ -0,0 +1,61 @@
# jclouds ProfitBricks

## Terms
Like any cloud provider, ProfitBricks has its own set of terms in cloud computing. To abstract this into jclouds' Compute interface, these terms were associated:

- Node - composite instance of `Server` and `Storage`
- Image - both *user-uploaded* and *provided* `Images`; and `Snapshots`
- Location - `DataCenters` and `Region` (Las Vegas, Frankfurt, etc.)
- Hardware - number of cores, RAM size and storage size

## Getting Started

Assuming that there's **atleast one** datacenter existing in your account, the provider needs only an *identity* (your ProfitBricks email), and *credentials* (password) to provision a `Node`, by using a ProfitBricks-provided ubuntu-12.04 image as a template.

```java
ComputeService compute = ContextBuilder.newBuilder( "profitbricks" )
.credentials( "profitbricks email", "password" )
.buildView( ComputeServiceContext.class )
.getComputeService();
```


This works well; however, we won't be able to use jclouds' ability to execute *scripts* on a remote node. This is because, ProfitBricks' default images require users to change passwords upon first log in.

To enable jclouds to execute script, we need to use a custom image. The easiest way to do this is via ProfitBricks snapshot:

- Go to your [DCD](https://my.profitbricks.com/dashboard/).
- Provision a server + storage, and connect it to the internet. Upon success, you will receive an email containing the credentials needed to login to your server.
- Login to your server, and change the password, as requested.

```
~ ssh root@<remote-ip>
...
Changing password for root.
(current) UNIX password:
Enter new UNIX password:
Retype new UNIX password:
~ root@ubuntu:~# exit
```

- Go back to the DCD, and *make a snapshot* of the storage. Put a descriptive name.
- Configure jclouds to use this *snapshot*.

```java
Template template = compute.templateBuilder()
.imageNameMatches( "<ideally-unique-snapshot-name>" )
.options( compute.templateOptions()
.overrideLoginUser( "root" ) // unless you changed the user
.overrideLoginPassword( "<changed-password>" ))
// more options, as you need
.build();
compute.createNodesInGroup( "cluster1", 1, template );
```

## Limitations

- There's no direct way of specifying arbitrary number of cores, RAM size, and storage size via the compute interface, at least until after [JCLOUDS-482](https://issues.apache.org/jira/browse/JCLOUDS-482) is resolved. The adapter uses a predefined list hardware profiles instead.

> Take note that these features are still accessible by *unwraping* the ProfitBricks API, but this'll reduce portability of your code. See [Concepts](https://jclouds.apache.org/start/concepts/).
@@ -0,0 +1,151 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.jclouds.labs</groupId>
<artifactId>jclouds-labs</artifactId>
<version>2.0.0-SNAPSHOT</version>
</parent>

<!-- TODO: when out of labs, switch to org.jclouds.api -->
<artifactId>profitbricks</artifactId>
<name>jclouds ProfitBricks api</name>
<description>jclouds components to access an implementation of ProfitBricks</description>
<packaging>bundle</packaging>

<properties>
<test.profitbricks.endpoint>https://api.profitbricks.com/1.3</test.profitbricks.endpoint>
<test.profitbricks.identity>FIXME</test.profitbricks.identity>
<test.profitbricks.credential>FIXME</test.profitbricks.credential>
<test.profitbricks.api-version>1.3</test.profitbricks.api-version>
<jclouds.osgi.export>org.jclouds.profitbricks*;version="${project.version}"</jclouds.osgi.export>
<jclouds.osgi.import>
org.jclouds.labs*;version="${project.version}",
org.jclouds*;version="${jclouds.version}",
*
</jclouds.osgi.import>
</properties>

<dependencies>
<dependency>
<groupId>org.apache.jclouds</groupId>
<artifactId>jclouds-core</artifactId>
<version>${jclouds.version}</version>
</dependency>
<dependency>
<groupId>org.apache.jclouds</groupId>
<artifactId>jclouds-compute</artifactId>
<version>${jclouds.version}</version>
</dependency>
<dependency>
<groupId>com.google.auto.service</groupId>
<artifactId>auto-service</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.auto.value</groupId>
<artifactId>auto-value</artifactId>
<scope>provided</scope>
</dependency>
<!-- Test dependencies -->
<dependency>
<groupId>org.apache.jclouds</groupId>
<artifactId>jclouds-core</artifactId>
<version>${jclouds.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.jclouds</groupId>
<artifactId>jclouds-compute</artifactId>
<version>${jclouds.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.jclouds.driver</groupId>
<artifactId>jclouds-sshj</artifactId>
<version>${jclouds.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.squareup.okhttp</groupId>
<artifactId>mockwebserver</artifactId>
<scope>test</scope>
<exclusions>
<!-- Already provided by jclouds-sshj -->
<exclusion>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.jclouds.driver</groupId>
<artifactId>jclouds-slf4j</artifactId>
<version>${jclouds.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<profiles>
<profile>
<id>live</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<executions>
<execution>
<id>integration</id>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<threadCount>1</threadCount>
<systemPropertyVariables>
<test.profitbricks.endpoint>${test.profitbricks.endpoint}</test.profitbricks.endpoint>
<test.profitbricks.identity>${test.profitbricks.identity}</test.profitbricks.identity>
<test.profitbricks.credential>${test.profitbricks.credential}</test.profitbricks.credential>
<test.profitbricks.api-version>${test.profitbricks.api-version}</test.profitbricks.api-version>
<test.profitbricks.template>${test.profitbricks.template}</test.profitbricks.template>
</systemPropertyVariables>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>