Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🔀 release/1.0.0 #50

Merged
merged 3 commits into from
Jul 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<groupId>io.codeka</groupId>
<artifactId>gaia</artifactId>
<version>0.0.1-SNAPSHOT</version>
<version>1.0.0</version>
<name>gaia</name>
<description>gaia runs yours terraform modules</description>

Expand Down
58 changes: 0 additions & 58 deletions src/main/java/io/codeka/gaia/Gaia.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,62 +23,4 @@ public static void main(String[] args) {
SpringApplication.run(Gaia.class, args);
}

@Bean
@Autowired
CommandLineRunner cli(TerraformModuleRepository repository,
TerraformStateRepository terraformStateRepository,
StackRepository stackRepository){
return args -> {
repository.deleteAll();
//terraformStateRepository.deleteAll();
stackRepository.deleteAll();

// create dummy module for tests
repository.saveAll(List.of(buildDockerMongoModule()));

var stack = new Stack();
stack.setId("5a215b6b-fe53-4afa-85f0-a10175a7f264");
stack.setName("mongo-instance-1");
stack.setDescription("first instance of mongo module");
stack.setModuleId("e01f9925-a559-45a2-8a55-f93dc434c676");
stack.getVariableValues().put("mongo_container_name", "test");
stack.getVariableValues().put("mongo_exposed_port", "27117");
stack.setProviderSpec("provider \"docker\" {\n" +
" host = \"unix:///var/run/docker.sock\"\n" +
"}");
stackRepository.save(stack);

var stack2 = new Stack();
stack2.setId("143773fa-4c2e-4baf-a7fb-79d23e01c5ca");
stack2.setName("mongo-instance-2");
stack2.setDescription("second instance of mongo module");
stack2.setModuleId("e01f9925-a559-45a2-8a55-f93dc434c676");
stackRepository.save(stack2);
};
}

private TerraformModule buildDockerMongoModule() {
var module = new TerraformModule();
module.setId("e01f9925-a559-45a2-8a55-f93dc434c676");
module.setName("terraform-docker-mongo");
module.setDescription("A sample terraform \uD83C\uDF0D module for running a mongodb \uD83C\uDF43 database inside a docker \uD83D\uDC33 container");
module.setGitRepositoryUrl("https://github.com/juwit/terraform-docker-mongo.git");
module.setDirectory("");
module.setGitBranch("master");

var tvar = new TerraformVariable();
tvar.setName("mongo_container_name");
tvar.setDescription("the name of the docker container");
tvar.setEditable(true);

var tvar2 = new TerraformVariable();
tvar2.setName("mongo_exposed_port");
tvar2.setDescription("the exposed port of the mongo container");
tvar2.setDefaultValue("27017");
tvar2.setEditable(true);

module.setVariables(List.of(tvar, tvar2));
return module;
}

}
2 changes: 1 addition & 1 deletion src/main/java/io/codeka/gaia/runner/StackRunner.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ private int runContainerForJob(Job job, String script){
.build();

// pull the image
dockerClient.pull("hashicorp/terraform:0.11.14");
dockerClient.pull("hashicorp/terraform:0.12.3");

System.out.println("Create container");
var containerCreation = dockerClient.createContainer(containerConfig);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ DockerClient client(Settings settings) {
@Bean
ContainerConfig.Builder containerConfig(){
return ContainerConfig.builder()
.image("hashicorp/terraform:0.11.14")
.image("hashicorp/terraform:0.12.3")
// bind mounting the docker sock (to be able to use docker provider in terraform)
.hostConfig(HostConfig.builder().binds(HostConfig.Bind.builder().from("/var/run/docker.sock").to("/var/run/docker.sock").build()).build())
// resetting entrypoint to empty
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/templates/stack.html
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ <h2><span><i class="fas fa-history"></i> Job history</span></h2>
return $.get(`/api/state/${stackId}`)
.then(data => {
// finding stack output
stack.outputs = data.modules[0].outputs;
stack.outputs = data.outputs;
})
.catch(e => {
// a 404 means that the stack is new
Expand Down