Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View etoews's full-sized avatar

Everett Toews etoews

View GitHub Profile
[[local|localrc]]
# Credentials
DATABASE_PASSWORD=devstack
ADMIN_PASSWORD=devstack
SERVICE_PASSWORD=devstack
SERVICE_TOKEN=devstack
RABBIT_PASSWORD=devstack
# Services
/*
* 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
*
@etoews
etoews / Test.java
Created August 7, 2012 17:48
jclouds resize broken (Rackspace)
package com.rackspace;
import java.lang.Thread.UncaughtExceptionHandler;
import org.jclouds.ContextBuilder;
import org.jclouds.compute.ComputeServiceContext;
import org.jclouds.compute.domain.NodeMetadata;
import org.jclouds.compute.domain.NodeMetadata.Status;
import org.jclouds.compute.domain.NodeMetadataBuilder;
import org.jclouds.enterprise.config.EnterpriseConfigurationModule;
@etoews
etoews / install.sh
Created August 15, 2012 15:18
Getting started with jclouds
$ mkdir jclouds-test
$ cd jcloud-test
$ curl -o lein.sh https://raw.github.com/technomancy/leiningen/stable/bin/lein
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 9905 100 9905 0 0 13005 0 --:--:-- --:--:-- --:--:-- 31444
$ chmod u+x lein.sh
$ echo '(defproject deps "1" :dependencies [[org.jclouds/jclouds-all "1.5.1"] [org.jclouds.driver/jclouds-sshj "1.5.1"]])' > project.clj
$ ./lein.sh deps
<output omitted>
@etoews
etoews / JCloudsTest.java
Created August 15, 2012 15:27
Getting started with jclouds
import java.util.Set;
import java.lang.Thread.UncaughtExceptionHandler;
import org.jclouds.ContextBuilder;
import org.jclouds.compute.ComputeService;
import org.jclouds.compute.ComputeServiceContext;
import org.jclouds.compute.domain.ComputeMetadata;
public class JCloudsTest {
private ComputeService compute;
@etoews
etoews / compile.sh
Created August 15, 2012 15:30
Getting started with jclouds
$ pwd
/Users/phymata/test/jclouds-test
$ ls
JCloudsTest.java lein.sh lib project.clj
$ javac -cp ".:lib/*" JCloudsTest.java
$ ls
JCloudsTest$1.class JCloudsTest.class JCloudsTest.java lein.sh lib project.clj
$ java -cp ".:lib/*" JCloudsTest
Calling listNodes...
Total Number of Nodes = 1
@etoews
etoews / token.sh
Created August 17, 2012 16:24
Get a token from the Rackspace Open Cloud
$ TOKEN=`curl -s -X POST https://identity.api.rackspacecloud.com/v2.0/tokens -d '{"auth": {"passwordCredentials": {"username":"MY_USERNAME", "password":"MY_PASSWORD"}}}' -H "Content-type: application/json" | python -c 'import json,sys; response=json.loads(sys.stdin.read()); print response["access"]["token"]["id"]'`
$ echo $TOKEN
9d1dc8da-d306-4e39-b9c2-f39a127341f1
@etoews
etoews / JCloudsLoggingExample.java
Created August 18, 2012 18:28
Logging with jclouds
import java.lang.Thread.UncaughtExceptionHandler;
import java.util.Set;
import org.jclouds.ContextBuilder;
import org.jclouds.compute.ComputeService;
import org.jclouds.compute.ComputeServiceContext;
import org.jclouds.compute.domain.ComputeMetadata;
import org.jclouds.logging.slf4j.config.SLF4JLoggingModule;
import com.google.common.collect.ImmutableSet;
@etoews
etoews / compile.sh
Created August 18, 2012 18:33
Logging with jclouds
$ javac -cp ".:lib/*" JCloudsLoggingExample.java
$ java -cp ".:lib/*" JCloudsLoggingExample
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Calling listNodes...
Total Number of Nodes = 1
@etoews
etoews / logback.xml
Created August 18, 2012 19:17
Logging with jclouds
<?xml version="1.0"?>
<configuration scan="false">
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>- %m%n</pattern>
</encoder>
</appender>
<logger name="jclouds.wire">
<level value="DEBUG" />