Skip to content

Commit

Permalink
LAST RELEASE TO SUPPORT 0.6.5!
Browse files Browse the repository at this point in the history
added stuff for containerizing the application
  • Loading branch information
grimsi committed Apr 3, 2019
1 parent 46ed9f6 commit 33af960
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 22 deletions.
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<project xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
<groupId>grimsi.accservermanager</groupId>
<artifactId>backend</artifactId>
<artifactId>accservermanager</artifactId>
<packaging>jar</packaging>
<name>accservermanager-backend</name>
<version>1.0.0-RC1</version>
<name>accservermanager</name>
<version>1.0.0-RC2</version>
<properties>
<java.version>1.8</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.spotify.docker.client.DefaultDockerClient;
import com.spotify.docker.client.DockerClient;
import com.spotify.docker.client.exceptions.DockerCertificateException;
import com.spotify.docker.client.exceptions.DockerException;
import com.spotify.docker.client.messages.*;
import grimsi.accservermanager.backend.configuration.ApplicationConfiguration;
Expand All @@ -22,7 +23,6 @@
@Service
public class ContainerService {

private final DockerClient docker;
@Autowired
InstanceService instanceService;
@Autowired
Expand All @@ -31,23 +31,29 @@ public class ContainerService {
Environment env;
@Autowired
ApplicationConfiguration config;
private DockerClient docker;
private Logger log = LoggerFactory.getLogger(ContainerService.class);

@Autowired
public ContainerService(UtilityService utilityService) {
switch (utilityService.getHostOS()) {
case WINDOWS:
docker = new DefaultDockerClient("http://localhost:2375");
break;
case UNIX:
docker = new DefaultDockerClient("unix:///var/run/docker.sock");
break;
case MAC:
docker = new DefaultDockerClient("unix:///var/run/docker.sock");
break;
default:
docker = new DefaultDockerClient("unix:///var/run/docker.sock");
break;
docker = new DefaultDockerClient("unix:///var/run/docker.sock");
try {
switch (utilityService.getHostOS()) {
case WINDOWS:
docker = new DefaultDockerClient("http://localhost:2375");
break;
case UNIX:
docker = DefaultDockerClient.fromEnv().build();
break;
case MAC:
docker = DefaultDockerClient.fromEnv().build();
break;
default:
docker = DefaultDockerClient.fromEnv().build();
break;
}
} catch (DockerCertificateException e) {
log.error(e.getMessage());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ public class StartupService {

public void initialize() {

initUsers();
log.info("Created user with username '" + config.getUsername() + "' and user-defined password.");

initFileSystem();
log.info("Initialized filesystem.");

Expand All @@ -43,9 +46,6 @@ public void initialize() {

initContainers();
log.info("Initialized containers.");

initUsers();
log.info("Created user with username '" + config.getUsername() + "' and user-defined password.");
}

private void initFileSystem() {
Expand Down
2 changes: 0 additions & 2 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ management.endpoints.web.exposure.include=*
management.endpoints.web.base-path=
spring.mvc.static-path-pattern=/resources/public/**
# Database
spring.data.mongodb.host=localhost
spring.data.mongodb.port=27017
spring.data.mongodb.database=accservermanager
# Spring
spring.jackson.date-format=grimsi.accservermanager.backend.configuration.RFC3339DateFormat
Expand Down

0 comments on commit 33af960

Please sign in to comment.