Skip to content

Commit

Permalink
Elastisearch docker-compose for offline tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Svana committed Nov 22, 2024
1 parent 1a4eea6 commit 9cf35bf
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 2 deletions.
66 changes: 66 additions & 0 deletions apps/web/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
version: '3'
services:
elasticsearch:
image: docker.io/elasticsearch:8.8.0
ports:
- 9200:9200
- 9300:9300
environment:
- discovery.type=single-node
- xpack.security.enabled=false
healthcheck:
test: ['CMD-SHELL', 'curl -f http://localhost:9200 || exit 1']
interval: 10s
retries: 10

init-elasticsearch:
image: docker.io/curlimages/curl:7.85.0
depends_on:
elasticsearch:
condition: service_healthy
entrypoint: >
sh -c "
until curl -s http://elasticsearch:9200; do
echo 'Waiting for Elasticsearch...';
sleep 5;
done;
curl -X PUT 'http://elasticsearch:9200/island-is-kstnl' -H 'Content-Type: application/json' -d'
{
\"settings\": {
\"number_of_shards\": 1,
\"number_of_replicas\": 1
},
\"mappings\": {
\"properties\": {
\"title\": {
\"type\": \"text\",
\"fields\": {
\"sort\": {
\"type\": \"keyword\"
}
}
},
\"dateUpdated\": {
\"type\": \"date\"
},
\"dateCreated\": {
\"type\": \"date\"
},
\"releaseDate\": {
\"type\": \"date\"
},
\"tags\": {
\"type\": \"nested\",
\"properties\": {
\"key\": {
\"type\": \"keyword\"
},
\"type\": {
\"type\": \"keyword\"
}
}
}
}
}
}';
"
4 changes: 2 additions & 2 deletions apps/web/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { createPlaywrightConfig } from '@island.is/testing/e2e'

const playwrightConfig = createPlaywrightConfig({
webServerUrl: 'http://localhost:4200',
command:
'yarn infra run-local-env web --dependencies api --print --no-secrets --proxies',
app: 'web',
dependencies: ['api'],
})

export default playwrightConfig
8 changes: 8 additions & 0 deletions apps/web/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,14 @@
"parallel": false
}
},
"dev-services": {
"executor": "nx:run-commands",
"options": {
"command": "docker compose up -d",
"cwd": "apps/web"
},
"configurations": {}
},
"dev": {
"executor": "nx:run-commands",
"options": {
Expand Down

0 comments on commit 9cf35bf

Please sign in to comment.