Skip to content

Commit

Permalink
wip docker compose
Browse files Browse the repository at this point in the history
  • Loading branch information
jansorg committed Jul 12, 2024
1 parent 19d0205 commit 6a7fafe
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 7 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ Instead of options, you can use the following environment variables:
--port: MARKETPLACE_SERVER_PORT
--host: MARKETPLACE_SERVER_HOSTNAME
--exchange-rate-api: MARKETPLACE_EXCHANGE_RATE_API
--display-currency: MARKETPLACE_DISPLAY_CURRENCY
--debug: MARKETPLACE_LOG_LEVEL
```

For example:
Expand Down
52 changes: 46 additions & 6 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,61 @@
services:
jetbrains-marketplace-stats:
container_name: jetbrains-marketplace-stats
image: jansorg/jetbrains-marketplace-stats:latest
restart: unless-stopped
image: jansorg/jetbrains-marketplace-stats:display-currency
restart: always
networks:
- jetbrains-marketplace
ports:
- "8080:8080"
- "8080:8081"
environment:
# You have to add your own JetBrains Marketplace API key here
# Required: You have to add your own JetBrains Marketplace API key here
- MARKETPLACE_API_KEY=your-api-key
# Defines which currency is used to display monetary amounts
- MARKETPLACE_DISPLAY_CURRENCY=USD
- MARKETPLACE_SERVER_PORT=8081
- MARKETPLACE_EXCHANGE_RATE_API=http://frankfurter:8080
# none, normal or verbose
- MARKETPLACE_LOG_LEVEL=none

frankfurter:
image: postgres
container_name: jetbrains-marketplace-frankfurter
image: hakanensari/frankfurter:latest
restart: always
networks:
- jetbrains-marketplace
links:
- "db:database"
expose:
- 8080
depends_on:
db:
condition: service_healthy
environment:
POSTGRES_PASSWORD: example
DATABASE_URL: postgres://postgres:very_secure@db:5432/jetbrains_marketplace

db:
container_name: jetbrains-marketplace-postgres
image: postgres:12
restart: always
user: postgres
healthcheck:
test: [ "CMD-SHELL", "pg_isready" ]
interval: 2s
timeout: 5s
retries: 10
networks:
- jetbrains-marketplace
expose:
- 5432
volumes:
- frankfurter-cache:/var/lib/postgresql/data
environment:
POSTGRES_PASSWORD: very_secure
POSTGRES_DB: jetbrains_marketplace

networks:
jetbrains-marketplace:
driver: bridge

volumes:
frankfurter-cache:
2 changes: 1 addition & 1 deletion src/main/kotlin/dev/ja/marketplace/Application.kt
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class Application(version: String) : CliktCommand(
private val displayCurrency: String? by option("-c", "--currency", envvar = "MARKETPLACE_DISPLAY_CURRENCY")
.help("Currency for the displayed monetary amounts.")

private val logging: ClientLogLevel by option("-d", "--debug").enum<ClientLogLevel>(key = { it.name.lowercase() })
private val logging: ClientLogLevel by option("-d", "--debug", envvar = "MARKETPLACE_LOG_LEVEL").enum<ClientLogLevel>(key = { it.name.lowercase() })
.default(ClientLogLevel.None)
.help("The log level used for the server and the API requests to the marketplace")

Expand Down

0 comments on commit 6a7fafe

Please sign in to comment.