Skip to content

Commit 9f9e351

Browse files
committed
GH-119: Added docker compose file
1 parent 3b9283e commit 9f9e351

File tree

14 files changed

+64
-38
lines changed

14 files changed

+64
-38
lines changed

.docker/.env

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
COMPOSE_PROJECT_NAME=codegarten

.docker/docker-compose.yml

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
version: "3.3"
2+
services:
3+
codegarten-server:
4+
container_name: codegarten-server
5+
build:
6+
context: ../code/jvm
7+
dockerfile: Dockerfile
8+
env_file: ./env_server
9+
environment:
10+
- JDBC_DATABASE_URL=jdbc:postgresql://codegarten-db:5432/db?user=codegarten&password=changeit
11+
- CODEGARTEN_TEST_DB_CONNECTION_STRING=jdbc:postgresql://codegarten-db-tests:5433/db?user=codegarten&password=changeit
12+
depends_on:
13+
- codegarten-db
14+
- codegarten-db-tests
15+
ports:
16+
- 8080:8080
17+
codegarten-web:
18+
container_name: codegarten-web
19+
build:
20+
context: ../code/js
21+
dockerfile: Dockerfile
22+
env_file: ./env_web
23+
environment:
24+
- CG_SERVER_API_HOST=http://codegarten-server:8080
25+
- CG_SERVER_IM_HOST=http://localhost:8080
26+
depends_on:
27+
- codegarten-server
28+
ports:
29+
- 80:80
30+
codegarten-db:
31+
container_name: codegarten-db
32+
build:
33+
context: ../code
34+
dockerfile: jvm/tests/Dockerfile-codegarten-db
35+
environment:
36+
- POSTGRES_USER=codegarten
37+
- POSTGRES_PASSWORD=changeit
38+
- POSTGRES_DB=db
39+
ports:
40+
- 5432:5432
41+
codegarten-db-tests:
42+
container_name: codegarten-db-tests
43+
build:
44+
context: ../code
45+
dockerfile: jvm/tests/Dockerfile-codegarten-db-tests
46+
environment:
47+
- POSTGRES_USER=codegarten
48+
- POSTGRES_PASSWORD=changeit
49+
- POSTGRES_DB=db
50+
ports:
51+
- 5433:5432

.gitignore

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# Docker environment files
2+
env_web
3+
env_server
4+
15
# Logs
26
logs
37
*.log
@@ -68,10 +72,6 @@ typings/
6872
# Yarn Integrity file
6973
.yarn-integrity
7074

71-
# dotenv environment variables file
72-
.env
73-
.env.test
74-
7575
# parcel-bundler cache (https://parceljs.org/)
7676
.cache
7777

code/js/Dockerfile

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ WORKDIR /app
44

55
COPY ./node_modules ./node_modules
66
COPY ./public ./public
7-
COPY secrets ./secrets
87
COPY ./dist ./dist
98
COPY ./views ./views
109

code/jvm/Dockerfile

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ WORKDIR /app
55

66
COPY ${DEPENDENCY}/BOOT-INF/lib ./server/lib
77
COPY ${DEPENDENCY}/META-INF ./server/META-INF
8-
COPY secrets ./secrets
98
COPY ${DEPENDENCY}/BOOT-INF/classes ./server
109

1110
EXPOSE 8080

code/jvm/secrets-example/README.md

-2
This file was deleted.

code/jvm/secrets-example/cipher-key.txt

-1
This file was deleted.

code/jvm/secrets-example/gh-app-private-key.pem

-17
This file was deleted.

code/jvm/secrets-example/github-app-properties.json

-6
This file was deleted.

code/jvm/src/main/kotlin/org/ionproject/codegarten/CodeGartenApplication.kt

-2
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ import org.springframework.util.Base64Utils
2525
import org.springframework.web.method.support.HandlerMethodArgumentResolver
2626
import org.springframework.web.servlet.config.annotation.InterceptorRegistry
2727
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer
28-
import java.lang.IllegalArgumentException
29-
import java.lang.IllegalStateException
3028
import java.net.URI
3129

3230
@ConfigurationPropertiesScan

code/jvm/src/main/kotlin/org/ionproject/codegarten/pipeline/exceptionhandling/ExceptionHandler.kt

+1
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ class ExceptionHandler {
192192
val cause = ex.cause as SQLException
193193
val psqlError = ex.getPsqlErrorCode()
194194

195+
logger.error("[DB Exception] ${cause.localizedMessage}")
195196
if (psqlError == null) {
196197
return handleExceptionResponse(
197198
URI("/problems/database-error"),

code/jvm/src/main/kotlin/org/ionproject/codegarten/utils/CryptoUtils.kt

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ package org.ionproject.codegarten.utils
33
import org.bouncycastle.jce.provider.BouncyCastleProvider
44
import org.bouncycastle.util.io.pem.PemReader
55
import org.springframework.util.Base64Utils
6-
import java.io.FileReader
7-
import java.io.Reader
86
import java.security.Key
97
import java.security.KeyFactory
108
import java.security.MessageDigest

code/jvm/src/test/kotlin/org/ionproject/codegarten/auth/AuthHeaderValidatorTest.kt

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ package org.ionproject.codegarten.auth
22

33
import org.ionproject.codegarten.database.dto.User
44
import org.ionproject.codegarten.exceptions.AuthorizationException
5-
import org.junit.jupiter.api.Assertions.*
5+
import org.junit.jupiter.api.Assertions.assertEquals
6+
import org.junit.jupiter.api.Assertions.assertThrows
7+
import org.junit.jupiter.api.Assertions.fail
68
import org.junit.jupiter.api.Test
79

810
class AuthHeaderValidatorTest {

code/jvm/src/test/kotlin/org/ionproject/codegarten/utils/CryptoUtilsTest.kt

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
package org.ionproject.codegarten.utils
22

3-
import org.junit.jupiter.api.Assertions.*
3+
import org.junit.jupiter.api.Assertions.assertEquals
4+
import org.junit.jupiter.api.Assertions.assertFalse
5+
import org.junit.jupiter.api.Assertions.assertNotEquals
6+
import org.junit.jupiter.api.Assertions.assertTrue
47
import org.junit.jupiter.api.Test
58
import org.springframework.beans.factory.annotation.Autowired
69
import org.springframework.boot.test.context.SpringBootTest

0 commit comments

Comments
 (0)