-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: make system work in docker compose
- Loading branch information
Showing
15 changed files
with
118 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,58 @@ | ||
# cspell:words initdb healthcheck pg_isready | ||
services: | ||
web: | ||
build: ./packages/ui | ||
ports: | ||
- "8080:80" | ||
net: | ||
build: | ||
context: ./packages | ||
dockerfile: ./cli/Dockerfile | ||
args: | ||
- BIN=network_execute | ||
depends_on: | ||
db: | ||
condition: service_healthy | ||
cli: | ||
build: | ||
context: ./packages | ||
dockerfile: ./cli/Dockerfile | ||
args: | ||
- BIN=cli | ||
environment: | ||
- ST_AGENT=${ST_AGENT} | ||
- ST_EMAIL=${ST_EMAIL} | ||
- ST_FACTION=${ST_FACTION} | ||
depends_on: | ||
net: | ||
condition: service_started | ||
db: | ||
condition: service_healthy | ||
idle: | ||
build: | ||
context: ./packages | ||
dockerfile: ./cli/Dockerfile | ||
args: | ||
- BIN=idle_queue | ||
depends_on: | ||
net: | ||
condition: service_started | ||
db: | ||
condition: service_healthy | ||
db: | ||
image: postgres:15.3-alpine3.18 | ||
restart: always | ||
environment: | ||
- POSTGRES_USER=postgres | ||
- POSTGRES_PASSWORD=postgres | ||
- POSTGRES_DB=spacetraders | ||
ports: | ||
- "5432:5432" | ||
healthcheck: | ||
test: ["CMD-SHELL", "pg_isready -U postgres"] | ||
interval: 5s | ||
timeout: 5s | ||
retries: 5 | ||
volumes: | ||
- ./db_data:/var/lib/postgresql/data | ||
- ./packages/db/sql/tables:/docker-entrypoint-initdb.d/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,7 +41,6 @@ words: | |
- sublist | ||
- codegen | ||
- URANITE | ||
- callsign | ||
- writeln | ||
- undocked | ||
- ratelimit | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,17 @@ | ||
import 'package:cli/net/auth.dart'; | ||
import 'package:cli/net/counts.dart'; | ||
import 'package:db/db.dart'; | ||
import 'package:file/memory.dart'; | ||
import 'package:mocktail/mocktail.dart'; | ||
import 'package:test/test.dart'; | ||
|
||
class _MockDatabase extends Mock implements Database {} | ||
|
||
void main() { | ||
test('loadAuthToken', () { | ||
final fs = MemoryFileSystem.test(); | ||
test('loadAuthToken', () async { | ||
final db = _MockDatabase(); | ||
expect(() => loadAuthToken(fs), throwsException); | ||
expect(() => defaultApi(fs, db), throwsException); | ||
|
||
fs.file(defaultAuthTokenPath) | ||
..createSync(recursive: true) | ||
..writeAsStringSync('token\n\n'); | ||
expect(loadAuthToken(fs), 'token'); | ||
|
||
final api = defaultApi(fs, db); | ||
expect(() => defaultApi(db), throwsException); | ||
when(() => db.getAuthToken()).thenAnswer((_) async => 'token'); | ||
final api = await defaultApi(db); | ||
expect(api.apiClient, isA<CountingApiClient>()); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
-- global configuration settings | ||
CREATE TABLE config ( | ||
key TEXT NOT NULL PRIMARY KEY, | ||
value TEXT NOT NULL | ||
); |