Guest User

Untitled

a guest
Jan 16th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.94 KB | None | 0 0
  1. test:
  2. image: docker
  3. stage: test
  4. services:
  5. - docker:dind
  6. script:
  7. - APP_CONTAINER_ID=`docker run -d --privileged -p "9143:9143" appropriate/nc nc -l 9143`
  8. - netstat -a
  9. - docker exec $APP_CONTAINER_ID netstat -a
  10. - nc -v localhost 9143
  11.  
  12. gitlab-ci-multi-runner exec docker --docker-privileged test
  13.  
  14. $ netstat -a
  15. Active Internet connections (servers and established)
  16. Proto Recv-Q Send-Q Local Address Foreign Address State
  17. tcp 0 0 runner--project-1-concurrent-0:54664 docker:2375 TIME_WAIT
  18. tcp 0 0 runner--project-1-concurrent-0:54666 docker:2375 TIME_WAIT
  19. Active UNIX domain sockets (servers and established)
  20. Proto RefCnt Flags Type State I-Node Path
  21.  
  22. $ docker exec $APP_CONTAINER_ID netstat -a
  23. Active Internet connections (servers and established)
  24. Proto Recv-Q Send-Q Local Address Foreign Address State
  25. tcp 0 0 0.0.0.0:9143 0.0.0.0:* LISTEN
  26. Active UNIX domain sockets (servers and established)
  27. Proto RefCnt Flags Type State I-Node Path
  28.  
  29. $ nc -v localhost 9143
  30. ERROR: Build failed: exit code 1
  31. FATAL: exit code 1
  32.  
  33. test:
  34. image: craigotis/buildtools:v1
  35. stage: test
  36. script:
  37. - docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN registry.gitlab.com/craigotis/myapp
  38. - docker-compose up -d
  39. - sleep 60 # a temporary hack to get the logs
  40. - docker-compose logs
  41. - docker-machine env
  42. - docker-compose port app 9143
  43. - netstat -a
  44. - docker-compose ps
  45. - /usr/local/bin/wait-for-it.sh -h localhost -p 9143 -t 60
  46. - cd mocha
  47. - npm i
  48. - npm test
  49. - docker-compose down
  50.  
  51. $ docker-compose logs
  52. ...
  53. app_1 | [Thread-1] INFO spark.webserver.SparkServer - == Spark has ignited ...
  54. app_1 | [Thread-1] INFO spark.webserver.SparkServer - >> Listening on 0.0.0.0:9143
  55. app_1 | [Thread-1] INFO org.eclipse.jetty.server.Server - jetty-9.0.z-SNAPSHOT
  56. app_1 | [Thread-1] INFO org.eclipse.jetty.server.ServerConnector - Started ServerConnector@6919dc5{HTTP/1.1}{0.0.0.0:9143}
  57. ...
  58.  
  59. $ docker-compose port app 9143
  60. 0.0.0.0:9143
  61.  
  62. $ netstat -a
  63. Active Internet connections (servers and established)
  64. Proto Recv-Q Send-Q Local Address Foreign Address State
  65. tcp 0 0 runner-e11ae361-project-1925166-concurrent-0:53646 docker:2375 TIME_WAIT
  66. tcp 0 0 runner-e11ae361-project-1925166-concurrent-0:53644 docker:2375 TIME_WAIT
  67. tcp 0 0 runner-e11ae361-project-1925166-concurrent-0:53642 docker:2375 TIME_WAIT
  68. Active UNIX domain sockets (servers and established)
  69. Proto RefCnt Flags Type State I-Node Path
  70.  
  71. $ docker-compose ps
  72. stty: standard input: Not a tty
  73. Name Command State Ports
  74. ----------------------------------------------------------------------------------------
  75. my_app_1 wait-for-it.sh mysql_serve ... Up 8080/tcp, 0.0.0.0:9143->9143/tcp
  76. mysql_server docker-entrypoint.sh --cha ... Up 3306/tcp
  77.  
  78. $ /usr/local/bin/wait-for-it.sh -h localhost -p 9143 -t 60
  79. wait-for-it.sh: waiting 60 seconds for localhost:9143
  80. wait-for-it.sh: timeout occurred after waiting 60 seconds for localhost:9143
  81.  
  82. version: '2'
  83.  
  84. networks:
  85. app_net:
  86. driver: bridge
  87.  
  88. services:
  89. app:
  90. image: registry.gitlab.com/craigotis/myapp:latest
  91. depends_on:
  92. - "db"
  93. networks:
  94. - app_net
  95. command: wait-for-it.sh mysql_server:3306 -t 60 -- java -jar /opt/app*.jar
  96. ports:
  97. - "9143:9143"
  98.  
  99. db:
  100. image: mysql:latest
  101. networks:
  102. - app_net
  103. container_name: mysql_server
  104. environment:
  105. - MYSQL_ALLOW_EMPTY_PASSWORD=true
  106.  
  107. 127.0.0.1 is the loopback address (also known as localhost).
  108. 0.0.0.0 is a non-routable meta-address used to designate an invalid, unknown, or non-applicable target (a ‘no particular address’ place holder).
Add Comment
Please, Sign In to add comment