Skip to content

Commit

Permalink
Merge pull request #50 from CodeKaio/release/1.0.0
Browse files Browse the repository at this point in the history
πŸ”€ release/1.0.0
  • Loading branch information
cdubuisson authored Jul 17, 2019
2 parents 75c1994 + 0197dcf commit ce1528b
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 62 deletions.
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

0 comments on commit ce1528b

Please sign in to comment.