Skip to content

Instantly share code, notes, and snippets.

View JacobASeverson's full-sized avatar

Jacob Severson JacobASeverson

  • Favor
  • Austin, TX
View GitHub Profile
@JacobASeverson
JacobASeverson / github.tf
Last active March 23, 2016 14:23
Example of managing a Github organization with Terraform
###
## <1> The two properties that need to be set are `token` and `organization`. You can hardcode them right in
## this provider block (very unrecommended) but the better option is to set the `GITHUB_TOKEN`
## and `GITHUB_ORGANIZATION` environment variables. Terraform will see those and configure the provider with them.
###
provider "github" { }
###
## <2> This assigns a user to the organization. the `username` property should be their string username.
###
# 1) Using the resource created in our previous example, do a conditional GET
# using the correct current ETag
curl -i -H "If-None-Match:2" localhost:8080/events/55555c2d4c6f98f355b003e
# Since the resource (and ETag) hasn't changed since our last interaction with
# its state, it only needs to send back a 304 with no response body
HTTP/1.1 304 Not Modified
Server: Apache-Coyote/1.1
ETag: "2"
Last-Modified: ...
# 1) POST a new Event to the server
curl -i -X POST -H "Content-Type:application/json" \
-d '{"name":"Basilica Block Party", "description":"Test description"}' \
http://localhost:8080/events
# 2) Notice that an ETag header is populated with the contents of the version field
# (starting at 0)
HTTP/1.1 201 Created
Server: Apache-Coyote/1.1
grails create-app grails-lattice-app
cd grails-lattice-app
# Run the app and make sure you get the stock welcome page
grails run-app
ltc status grails-lattice-app
ltc create grails-lattice-app {your-docker-hub-id}/grails-lattice-app:0.1
./gradlew build buildDocker
buildscript {
...
dependencies {
...
classpath('se.transmode.gradle:gradle-docker:1.2')
}
}
group = {your-docker-hub-id}
mkdir src/main/docker
vim src/main/docker/Dockerfile
FROM java:8
VOLUME /tmp
ADD grails-lattice-app-0.1.jar app.jar
RUN bash -c 'touch /app.jar'
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"]