Last active
January 17, 2019 14:57
-
-
Save phouverneyuff/88031271a53c2060720b6de8a536f797 to your computer and use it in GitHub Desktop.
twitter-databases
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
.metadata | |
mongo-data | |
postgres-kong-data | |
postgres-konga-data | |
collection-twitties | |
twitties-country | |
show-twitties-app |
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
#!/bin/bash | |
sudo tar -cvpzf mongo-data.tar.gz --one-file-system ./mongo-data | |
sudo tar -cvpzf postgres-kong-data.tar.gz --one-file-system ./postgres-kong-data | |
sudo tar -cvpzf postgres-konga-data.tar.gz --one-file-system ./postgres-konga-data |
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
#!/bin/bash | |
curl -i -X POST \ | |
--url http://localhost:8001/services/ \ | |
--data 'name=collector' \ | |
--data 'url=http://app-collector:8080/twitter/tag' | |
curl -i -X GET \ | |
--url http://localhost:8001/services/collector #0a48e3b3-5764-456f-bf5b-838e10c4fdd1 | |
curl -i -X POST \ | |
--url http://localhost:8001/routes/ \ | |
--data 'service.id=0a48e3b3-5764-456f-bf5b-838e10c4fdd1' \ | |
--data 'paths=/twitter/tag' \ | |
--data 'protocols[]=http' | |
# adicionando plugin para validar token jwt via auth0 | |
# https://comment.auth0.com/.well-known/openid-configuration | |
curl -i -X POST http://localhost:8001/consumers/phob/jwt \ | |
-F "algorithm=RS256" \ | |
-F "rsa_public_key=@./comment-pubkey.pem" \ | |
-F "key=https://comment.auth0.com/" # the `iss` field | |
# ----------- country ------------ | |
curl -i -X POST \ | |
--url http://localhost:8001/services/ \ | |
--data 'name=country' \ | |
--data 'url=http://app-twitties-country:8080/twitter/country' | |
curl -i -X GET \ | |
--url http://localhost:8001/services/country #12e134d4-540b-43c0-bc8d-b0ad1580a06c | |
curl -i -X POST \ | |
--url http://localhost:8001/routes/ \ | |
--data 'service.id=12e134d4-540b-43c0-bc8d-b0ad1580a06c' \ | |
--data 'paths=/twitter/country' \ | |
--data 'protocols[]=http' |
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
-----BEGIN PUBLIC KEY----- | |
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA6YqAOEKZvaIQXnQ/iv47 | |
4evvTmaCYRi2W7OzxWnMKt0dUPT4sPRUHVi34YPC9ddHkP37e1hEWRiVtfKBAn8J | |
cLLV8kHQ3CXLzDD/B3KMOL27AKjFm0tS+yvTRaY9pq9ge7Q6z4h0wE4WWq/1EnVP | |
Zdc4p1WA/weel1s3cvIZoWXP0gIYjYjxuWBStfrX+OKdIEomfZDufEcofln+Lzyg | |
FWazEmL07wOpr/ecWYIpbjVrkfxKKQDFETC7AqwyUgxBAqlTZoo0HtoMY0P1UNEs | |
+OmEcYaMwHQjrriX9mAHLmrHcWPIFm06BG42oKUfrgF6h0GgROo+xCZaUPO93gib | |
IQIDAQAB | |
-----END PUBLIC KEY----- |
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
-----BEGIN CERTIFICATE----- | |
MIIC/TCCAeWgAwIBAgIJB6vJSRTyRj49MA0GCSqGSIb3DQEBCwUAMBwxGjAYBgNV | |
BAMTEWNvbW1lbnQuYXV0aDAuY29tMB4XDTE4MDgyNTE4MDUwM1oXDTMyMDUwMzE4 | |
MDUwM1owHDEaMBgGA1UEAxMRY29tbWVudC5hdXRoMC5jb20wggEiMA0GCSqGSIb3 | |
DQEBAQUAA4IBDwAwggEKAoIBAQDpioA4Qpm9ohBedD+K/jvh6+9OZoJhGLZbs7PF | |
acwq3R1Q9Piw9FQdWLfhg8L110eQ/ft7WERZGJW18oECfwlwstXyQdDcJcvMMP8H | |
cow4vbsAqMWbS1L7K9NFpj2mr2B7tDrPiHTAThZar/USdU9l1zinVYD/B56XWzdy | |
8hmhZc/SAhiNiPG5YFK1+tf44p0gSiZ9kO58Ryh+Wf4vPKAVZrMSYvTvA6mv95xZ | |
giluNWuR/EopAMURMLsCrDJSDEECqVNmijQe2gxjQ/VQ0Sz46YRxhozAdCOuuJf2 | |
YAcuasdxY8gWbToEbjagpR+uAXqHQaBE6j7EJlpQ873eCJshAgMBAAGjQjBAMA8G | |
A1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFGQML/YuGqDl9NiEcvN7uMWgUFfOMA4G | |
A1UdDwEB/wQEAwIChDANBgkqhkiG9w0BAQsFAAOCAQEA1jm2bF9WFr/TZKFY3pcH | |
DJj+7UuhZjxYS4fbWNjzEX17BPHqcl/3b3FLWJ3K999YsgmByQPJPMBHT76DghN8 | |
mEoFD9XbMVH04KS5olKqxFniDcuu5spG8KQcbw+GjdUVzmmw3tLc0fx9iy3/cioe | |
rDu0xQVNLoPtPoa2cU78a9MVBlTkcQjtH41PoHTrwXNOGty7EmQm6SLfva0OI+zI | |
nm8BpkF6CE7RkWYmPGRK1Bse80XVw1NeEgWIXOtGvfSguYd7wuG8ZB9nazhvULHg | |
7YdcUiYK74Y7+r0Y4ik8RuAgTDEE3iTVHAK6cE+OKJGzrEJxoqJ18OaDK3ChIHV7 | |
1Q== | |
-----END CERTIFICATE----- |
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
#!/bin/bash | |
# https://docs.konghq.com/1.0.x/secure-admin-api/#kong-api-loopback | |
#cadastrando serviço de admin-api para ser servida pelo proprio gateway | |
curl -X POST http://localhost:8001/services \ | |
--data name=admin-api \ | |
--data host=localhost \ | |
--data port=8001 | |
curl -X GET http://localhost:8001/services | |
# criando rota no gateway para o o proprio gateway. Agora disponivel atraves da porta 8000 e 8443 | |
curl -X POST http://localhost:8001/services/admin-api/routes \ | |
--data paths[]=/admin-api | |
curl -X GET http://localhost:8001/services/admin-api/routes | |
#criando consumer | |
curl -X POST http://localhost:8001/consumers/ \ | |
--data "username=phob" \ | |
--data "custom_id=phob" | |
#criando api-key para consumer | |
curl -X GET http://localhost:8001/consumers/phob/key-auth #xwtLUsad9IFO3CBGDuTQLArLEKq9IyWI | |
curl -X POST http://localhost:8001/consumers/phob/key-auth -d '' | |
#protegendo a rota de admin-api com a key. Agora rota de admin pela porta 8000 está protegida com api-key | |
curl -X POST http://localhost:8001/services/admin-api/plugins \ | |
--data "name=key-auth" | |
# Usar a o dns criado pelo network do docker para o konga conectar no kong http://kong:8000/admin-api juntamente com a api-key criada para o consumer | |
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
#!/bin/bash | |
git clone https://gist.github.com/88031271a53c2060720b6de8a536f797.git twitter-paulo | |
echo "Repositorio com arquivos necessarios baixado" | |
cd ./twitter-paulo | |
echo $(pwd) | |
./restore-databases.sh | |
docker-compose up -d | |
docker ps |
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
version: '2.1' | |
services: | |
mongodb-twitter: | |
image: mongo:latest | |
environment: | |
- MONGO_DATA_DIR=/data/db | |
- MONGO_LOG_DIR=/dev/null | |
- MONGODB_APPLICATION_DATABASE=twitties | |
volumes: | |
- ./mongo-data/db:/data/db | |
ports: | |
- 27017:27017 | |
command: mongod --smallfiles --logpath=/dev/null # --quiet | |
app-collector: | |
image: phob/collection-twitties:latest | |
restart: always | |
ports: | |
- 9080:8080 | |
healthcheck: | |
test: ["CMD-SHELL", "curl -f http://localhost:8080/health || exit 1"] | |
interval: 4s | |
timeout: 3s | |
retries: 3 | |
environment: | |
- SPRING_DATA_MONGODB_URI=mongodb://mongodb:27017/twitties | |
depends_on: | |
- mongodb-twitter | |
links: | |
- mongodb-twitter:mongodb | |
app-twitties-country: | |
image: phob/twitties-country:latest | |
restart: always | |
ports: | |
- 9081:8080 | |
healthcheck: | |
test: ["CMD-SHELL", "curl -f http://localhost:8080/health || exit 1"] | |
interval: 4s | |
timeout: 3s | |
retries: 3 | |
environment: | |
- SPRING_DATA_MONGODB_URI=mongodb://mongodb:27017/twitties | |
depends_on: | |
- mongodb-twitter | |
links: | |
- mongodb-twitter:mongodb | |
postgres-kong: | |
image: postgres:9.5 | |
environment: | |
POSTGRES_DB: ${KONG_PG_DATABASE:-kong} | |
POSTGRES_PASSWORD: ${KONG_PG_PASSWORD:-kong} | |
POSTGRES_USER: ${KONG_PG_USER:-kong} | |
healthcheck: | |
test: ["CMD", "pg_isready", "-U", "${KONG_PG_USER:-kong}"] | |
interval: 30s | |
timeout: 30s | |
retries: 3 | |
ports: | |
- 5433:5432 | |
volumes: | |
- ./postgres-kong-data/data:/var/lib/postgresql/data | |
restart: on-failure | |
stdin_open: true | |
tty: true | |
kong-migrations: | |
image: "${KONG_DOCKER_TAG:-kong:latest}" | |
command: kong migrations up | |
depends_on: | |
postgres-kong: | |
condition: service_healthy | |
environment: | |
KONG_DATABASE: postgres | |
KONG_PG_DATABASE: ${KONG_PG_DATABASE:-kong} | |
KONG_PG_HOST: db | |
KONG_PG_PASSWORD: ${KONG_PG_PASSWORD:-kong} | |
KONG_PG_USER: ${KONG_PG_USER:-kong} | |
links: | |
- postgres-kong:db | |
kong: | |
image: "${KONG_DOCKER_TAG:-kong:latest}" | |
depends_on: | |
postgres-kong: | |
condition: service_healthy | |
kong-migrations: | |
condition: service_started | |
environment: | |
KONG_ADMIN_ACCESS_LOG: /dev/stdout | |
KONG_ADMIN_ERROR_LOG: /dev/stderr | |
KONG_ADMIN_LISTEN: '0.0.0.0:8001' | |
KONG_CASSANDRA_CONTACT_POINTS: db | |
KONG_DATABASE: postgres | |
KONG_PG_DATABASE: ${KONG_PG_DATABASE:-kong} | |
KONG_PG_HOST: db | |
KONG_PG_PASSWORD: ${KONG_PG_PASSWORD:-kong} | |
KONG_PG_USER: ${KONG_PG_USER:-kong} | |
KONG_PROXY_ACCESS_LOG: /dev/stdout | |
KONG_PROXY_ERROR_LOG: /dev/stderr | |
links: | |
- postgres-kong:db | |
- app-collector:app-collector | |
- app-twitties-country:app-twitties-country | |
ports: | |
- "8000:8000/tcp" | |
- "8001:8001/tcp" | |
- "8443:8443/tcp" | |
- "8444:8444/tcp" | |
restart: on-failure | |
postgres-konga: | |
image: postgres:9.5 | |
environment: | |
POSTGRES_DB: "konga" | |
POSTGRES_USER: "konga" | |
POSTGRES_PASSWORD: "9832kjsfd" | |
healthcheck: | |
test: ["CMD", "pg_isready", "-U", "konga"] | |
interval: 30s | |
timeout: 30s | |
retries: 3 | |
ports: | |
- 5432:5432 | |
volumes: | |
- ./postgres-konga-data/data:/var/lib/postgresql/data | |
restart: on-failure | |
stdin_open: true | |
tty: true | |
konga: | |
image: pantsel/konga | |
depends_on: | |
postgres-konga: | |
condition: service_healthy | |
links: | |
- postgres-konga:db | |
- kong:kong | |
environment: | |
TOKEN_SECRET: skjdfkshdfkjsn23498 | |
DB_ADAPTER: postgres | |
DB_HOST: db | |
DB_PORT: 5432 | |
DB_USER: "konga" | |
DB_PASSWORD: "9832kjsfd" | |
DB_DATABASE: "konga" | |
# NODE_ENV: production | |
ports: | |
- 1337:1337 | |
# healthcheck: | |
# test: ["CMD-SHELL", "curl -f http://localhost:1337/ || exit 1"] | |
# interval: 4s | |
# timeout: 3s | |
# retries: 3 | |
nginx: | |
image: phob/nginx-twitter:latest | |
restart: always | |
ports: | |
- 80:80 | |
depends_on: | |
- kong | |
links: | |
- kong:gateway | |
command: nginx -g 'daemon off'; |
View raw
(Sorry about that, but we can’t show files that are this big right now.)
View raw
(Sorry about that, but we can’t show files that are this big right now.)
View raw
(Sorry about that, but we can’t show files that are this big right now.)
View raw
(Sorry about that, but we can’t show files that are this big right now.)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment