|
| 1 | +networks: |
| 2 | + infradev: |
| 3 | + |
| 4 | +services: |
| 5 | + app: |
| 6 | + build: |
| 7 | + context: . |
| 8 | + dockerfile: Dockerfile |
| 9 | + args: |
| 10 | + VARIANT: 1.23-bullseye |
| 11 | + NODE_VERSION: "none" |
| 12 | + command: sleep infinity |
| 13 | +# uncomment along with bind volume to use SSH for dev container access |
| 14 | +# ports: |
| 15 | +# - "127.0.0.1:2224:2222" |
| 16 | + env_file: |
| 17 | + - spanner.env |
| 18 | + volumes: |
| 19 | + - ./nsc:/nsc |
| 20 | + - ./nats:/nats |
| 21 | + - ..:/workspace:cached |
| 22 | +# - type: bind |
| 23 | +# source: ~/.ssh/authorized_keys |
| 24 | +# target: /home/vscode/.ssh/authorized_keys |
| 25 | +# read_only: true |
| 26 | + networks: |
| 27 | + - infradev |
| 28 | + # Use "forwardPorts" in **devcontainer.json** to forward a port locally. |
| 29 | + # (Adding the "ports" property to this file will not forward from a Codespace.) |
| 30 | + |
| 31 | + # DB |
| 32 | + spanner: |
| 33 | + image: gcr.io/cloud-spanner-emulator/emulator |
| 34 | + networks: |
| 35 | + - infradev |
| 36 | + ports: |
| 37 | + - "9010:9010" |
| 38 | + - "9020:9020" |
| 39 | + |
| 40 | + spanner-pg: |
| 41 | + image: gcr.io/cloud-spanner-pg-adapter/pgadapter |
| 42 | + command: |
| 43 | + - "-p test-project" |
| 44 | + - "-i test-instance" |
| 45 | + - "-r autoConfigEmulator=true" |
| 46 | + - "-e spanner:9010" |
| 47 | + - "-c \"\"" |
| 48 | + - "-x" |
| 49 | + - -ddl=AutocommitExplicitTransaction |
| 50 | + ports: |
| 51 | + - "5432:5432" |
| 52 | + depends_on: |
| 53 | + - spanner |
| 54 | + networks: |
| 55 | + - infradev |
| 56 | + |
| 57 | + create-databases-pg: |
| 58 | + image: postgres:13.4 |
| 59 | + restart: on-failure:5 |
| 60 | + command: | |
| 61 | + psql -h spanner-pg -c 'CREATE DATABASE permissionsapi;' |
| 62 | + depends_on: |
| 63 | + - spanner-pg |
| 64 | + networks: |
| 65 | + - infradev |
| 66 | + |
| 67 | + create-databases-spanner: |
| 68 | + image: alpine/curl |
| 69 | + restart: on-failure:5 |
| 70 | + command: | |
| 71 | + curl -X POST \ |
| 72 | + http://spanner:9020/v1/projects/test-project/instances/test-instance/databases \ |
| 73 | + -H 'Content-Type: application/json' \ |
| 74 | + -d '{ |
| 75 | + "createStatement": "CREATE DATABASE spicedb", |
| 76 | + "databaseDialect": "GOOGLE_STANDARD_SQL" |
| 77 | + }' |
| 78 | + depends_on: |
| 79 | + create-databases-pg: |
| 80 | + condition: service_completed_successfully |
| 81 | + networks: |
| 82 | + - infradev |
| 83 | + |
| 84 | + create-goose-table: |
| 85 | + image: postgres:13.4 |
| 86 | + depends_on: |
| 87 | + create-databases-pg: |
| 88 | + condition: service_completed_successfully |
| 89 | + restart: on-failure:5 |
| 90 | + networks: |
| 91 | + - infradev |
| 92 | + command: | |
| 93 | + psql -h spanner-pg -d projects/test-project/instances/test-instance/databases/permissionsapi \ |
| 94 | + -c \ |
| 95 | + 'CREATE TABLE IF NOT EXISTS public.goose_db_version ( |
| 96 | + id BIGINT NOT NULL DEFAULT (extract(epoch from CURRENT_TIMESTAMP)*1000)::bigint, |
| 97 | + version_id BIGINT NOT NULL, |
| 98 | + is_applied BOOLEAN NOT NULL, |
| 99 | + tstamp TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP, |
| 100 | + PRIMARY KEY (id) |
| 101 | + ); |
| 102 | +
|
| 103 | + INSERT INTO goose_db_version (version_id, is_applied) VALUES (0, true);' |
| 104 | +
|
| 105 | + migrate_spicedb: |
| 106 | + image: authzed/spicedb:v1.38.1 |
| 107 | + command: datastore migrate head |
| 108 | + restart: on-failure:5 |
| 109 | + env_file: |
| 110 | + - spanner.env |
| 111 | + depends_on: |
| 112 | + create-databases-pg: |
| 113 | + condition: service_completed_successfully |
| 114 | + networks: |
| 115 | + - infradev |
| 116 | + |
| 117 | + spicedb: |
| 118 | + image: authzed/spicedb:v1.38.1 |
| 119 | + command: serve |
| 120 | + restart: unless-stopped |
| 121 | + env_file: |
| 122 | + - spanner.env |
| 123 | + depends_on: |
| 124 | + migrate_spicedb: |
| 125 | + condition: service_completed_successfully |
| 126 | + ports: |
| 127 | + - 50051:50051 |
| 128 | + networks: |
| 129 | + - infradev |
| 130 | + |
| 131 | + nats-init: |
| 132 | + image: natsio/nats-box |
| 133 | + environment: |
| 134 | + - NSC_HOME=/nsc |
| 135 | + volumes: |
| 136 | + - ./nsc:/nsc |
| 137 | + - ./nats:/nats |
| 138 | + - ./scripts:/scripts |
| 139 | + command: |
| 140 | + - /scripts/nats_init.sh |
| 141 | + |
| 142 | + nats: |
| 143 | + image: 'nats:alpine' |
| 144 | + depends_on: |
| 145 | + - nats-init |
| 146 | + command: |
| 147 | + - -c |
| 148 | + - '/etc/nats/nats-server.conf' |
| 149 | + - -D |
| 150 | + volumes: |
| 151 | + - ./nats/:/etc/nats |
| 152 | + restart: unless-stopped |
| 153 | + networks: |
| 154 | + - infradev |
| 155 | + |
| 156 | + jaeger: |
| 157 | + image: jaegertracing/all-in-one:1.60.0 |
| 158 | + environment: |
| 159 | + - COLLECTOR_OTLP_ENABLED=true |
| 160 | + ports: |
| 161 | + - 16688:16686 |
| 162 | + networks: |
| 163 | + - infradev |
| 164 | + |
| 165 | + mock-oauth2-server: |
| 166 | + image: ghcr.io/navikt/mock-oauth2-server:2.1.10 |
| 167 | + networks: |
| 168 | + - infradev |
| 169 | + environment: |
| 170 | + - PORT=8081 |
| 171 | + ports: |
| 172 | + - 8081:8081 |
0 commit comments