MDR Portal Notes.txt 3.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. salt 'ip-10*' cmd.run 'docker images --digests'MDR Portal Notes
  2. https://github.mdr.defpoint.com/MDR-Content/customer_portal/wiki
  3. Portal is a custom application running on Django app in docker.
  4. ------------
  5. Deploy Process
  6. salt 'ip-10*' test.ping
  7. salt 'ip-10*' cmd.run 'docker images'
  8. salt 'ip-10*' cmd.run 'docker container ls'
  9. salt 'ip-10*' cmd.run 'docker stop portal'
  10. salt 'ip-10*' cmd.run 'docker stop nginx'
  11. salt 'ip-10*' cmd.run 'docker rm portal'
  12. salt 'ip-10*' cmd.run 'docker rm nginx'
  13. salt 'ip-10*' cmd.run 'docker images'
  14. salt 'ip-10*' cmd.run 'docker images --digests'
  15. salt 'ip-10*' cmd.run 'docker rmi <image-id>'
  16. salt 'ip-10*' state.sls docker
  17. salt 'ip-10*' state.sls docker.portal
  18. (from the wiki page https://github.mdr.defpoint.com/MDR-Content/customer_portal/wiki)
  19. Last time i tried the ec2_tags grain targeting did not work.
  20. salt -G ‘ec2_tags:Name:customer-portal’ cmd.run “docker images” – You will need to grab the docker image ID for the container that needs to be updated
  21. salt -G ‘ec2_tags:Name:customer-portal’ cmd.run “docker stop portal”
  22. salt -G ‘ec2_tags:Name:customer-portal’ cmd.run “docker rm portal”
  23. salt -G ‘ec2_tags:Name:customer-portal’ cmd.run “docker rmi ${image id from above}
  24. salt -G ‘ec2_tags:Name:customer-portal’ state.sls docker
  25. salt -G ‘ec2_tags:Name:customer-portal’ state.sls docker.portal
  26. --------
  27. Troubleshooting the docker image
  28. salt 'ip-10*' cmd.run 'docker container ls'
  29. salt 'ip-10*' cmd.run 'docker exec portal ls'
  30. salt 'ip-10*' cmd.run 'docker exec portal cat /opt/portal/saml/idps.json'
  31. salt 'ip-10*' cmd.run 'docker exec portal cat /opt/portal/saml/sp.json'
  32. This will init the portal variables by pulling them from vault. SHOULD NOT NEED TO RUN IT
  33. salt 'ip-10*' cmd.run 'docker exec portal sh /opt/portal/init.sh'
  34. salt 'ip-10*' cmd.run 'docker exec portal cat /opt/portal/init.sh'
  35. Portal auths to Vault then pulls the creds
  36. salt 'ip-10*' cmd.run 'docker exec portal cat /usr/local/src/vault_auth.sh'
  37. docker exec -ti portal /usr/local/src/vault_auth.sh test
  38. ---
  39. Command line access
  40. docker exec -ti nginx bash
  41. salt 'ip-10*' cmd.run 'docker restart portal'
  42. salt 'ip-10*' cmd.run 'docker rm -f portal'
  43. salt 'ip-10*' cmd.run 'docker rm -f nginx'
  44. salt 'ip-10*' cmd.run 'docker pull 350838957895.dkr.ecr.us-east-1.amazonaws.com/portal_server'
  45. salt 'ip-10*' cmd.run 'docker pull 350838957895.dkr.ecr.us-east-1.amazonaws.com/django_nginx'
  46. salt 'ip-10*' cmd.run 'docker image ls'
  47. salt 'ip-10*' state.sls docker.portal
  48. ALL THE ERRORS:
  49. nginx: [emerg] host not found in upstream "portal:8000" in /etc/nginx/nginx.conf:27
  50. {"errors":["error making upstream request: error making request: Post https://sts.amazonaws.com//: dial tcp 52.94.241.129:443: i/o timeout"]}
  51. [WARNING ] The following arguments were ignored because they are not recognized by docker-py: [u'dns-search', u'network-alias']
  52. [WARNING ] The following arguments were ignored because they are not recognized by docker-py: [u'dns-search']
  53. SOULTION:
  54. NOT SURE! try stopping docker containers and service and starting back up with salt state.
  55. seems to be proxy issue
  56. working server...
  57. [dev]root@ip-10-97-10-248:~:# docker exec portal wget portal
  58. --2020-04-30 17:44:37-- http://portal/
  59. Resolving proxy.msoc.defpoint.local (proxy.msoc.defpoint.local)... 10.96.101.188
  60. Connecting to proxy.msoc.defpoint.local (proxy.msoc.defpoint.local)|10.96.101.188|:80... connected.
  61. Proxy request sent, awaiting response... 503 Service Unavailable
  62. 2020-04-30 17:44:38 ERROR 503: Service Unavailable.
  63. broken server...
  64. [dev]root@ip-10-97-9-59:~:# docker exec portal wget portal
  65. --2020-04-30 17:27:45-- http://portal/
  66. Resolving proxy.msoc.defpoint.local (proxy.msoc.defpoint.local)... failed: Name or service not known.
  67. wget: unable to resolve host address 'proxy.msoc.defpoint.local'
  68. docker exec portal wget portal
  69. sha256:598168ec922e79106fa3f8af35dd33313aa32ae859e77673b65d52ce93852810