Tiltfile 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. # Welcome to Tilt!
  2. # To get you started as quickly as possible, we have created a
  3. # starter Tiltfile for you.
  4. #
  5. # Uncomment, modify, and delete any commands as needed for your
  6. # project's configuration.
  7. # Output diagnostic messages
  8. # You can print log messages, warnings, and fatal errors, which will
  9. # appear in the (Tiltfile) resource in the web UI. Tiltfiles support
  10. # multiline strings and common string operations such as formatting.
  11. #
  12. # More info: https://docs.tilt.dev/api.html#api.warn
  13. print("""
  14. -----------------------------------------------------------------
  15. ✨ Hello Tilt! This appears in the (Tiltfile) pane whenever Tilt
  16. evaluates this file.
  17. -----------------------------------------------------------------
  18. """.strip())
  19. # k8s_yaml('kubernetes.yaml')
  20. # docker_build(
  21. # 'socket-server-image',
  22. # context='./wsocketserver/',
  23. # dockerfile='./wsocketserver/dockerfile')
  24. # docker_build(
  25. # 'api-image',
  26. # context='./api/',
  27. # dockerfile='./api/dockerfile')
  28. # docker_build(
  29. # 'rabbitmq-image',
  30. # context='./rabbitmq/',
  31. # dockerfile='./rabbitmq/dockerfile')
  32. # docker_build(
  33. # 'serialreader-image',
  34. # context='./serialreader/',
  35. # dockerfile='./serialreader/dockerfile')
  36. # docker_build(
  37. # 'persistance-image',
  38. # context='./',
  39. # dockerfile='./persistance/dockerfile')
  40. docker_compose('./docker-compose.yml')
  41. # k8s_resource('socket-server', port_forwards=8082)
  42. # k8s_resource('rabbitmq', port_forwards=[15672,5672])
  43. # k8s_resource('api', port_forwards=8089)
  44. # Build Docker image
  45. # Tilt will automatically associate image builds with the resource(s)
  46. # that reference them (e.g. via Kubernetes or Docker Compose YAML).
  47. #
  48. # More info: https://docs.tilt.dev/api.html#api.docker_build
  49. #
  50. # docker_build('registry.example.com/my-image',
  51. # context='.',
  52. # # (Optional) Use a custom Dockerfile path
  53. # dockerfile='./deploy/app.dockerfile',
  54. # # (Optional) Filter the paths used in the build
  55. # only=['./app'],
  56. # # (Recommended) Updating a running container in-place
  57. # # https://docs.tilt.dev/live_update_reference.html
  58. # live_update=[
  59. # # Sync files from host to container
  60. # sync('./app', '/src/'),
  61. # # Execute commands inside the container when certain
  62. # # paths change
  63. # run('/src/codegen.sh', trigger=['./app/api'])
  64. # ]
  65. # )
  66. # Apply Kubernetes manifests
  67. # Tilt will build & push any necessary images, re-deploying your
  68. # resources as they change.
  69. #
  70. # More info: https://docs.tilt.dev/api.html#api.k8s_yaml
  71. #
  72. # k8s_yaml(['k8s/deployment.yaml', 'k8s/service.yaml'])
  73. # Customize a Kubernetes resource
  74. # By default, Kubernetes resource names are automatically assigned
  75. # based on objects in the YAML manifests, e.g. Deployment name.
  76. #
  77. # Tilt strives for sane defaults, so calling k8s_resource is
  78. # optional, and you only need to pass the arguments you want to
  79. # override.
  80. #
  81. # More info: https://docs.tilt.dev/api.html#api.k8s_resource
  82. #
  83. # k8s_resource('my-deployment',
  84. # # map one or more local ports to ports on your Pod
  85. # port_forwards=['5000:8080'],
  86. # # change whether the resource is started by default
  87. # auto_init=False,
  88. # # control whether the resource automatically updates
  89. # trigger_mode=TRIGGER_MODE_MANUAL
  90. # )
  91. # Run local commands
  92. # Local commands can be helpful for one-time tasks like installing
  93. # project prerequisites. They can also manage long-lived processes
  94. # for non-containerized services or dependencies.
  95. #
  96. # More info: https://docs.tilt.dev/local_resource.html
  97. #
  98. # local_resource('install-helm',
  99. # cmd='which helm > /dev/null || brew install helm',
  100. # # `cmd_bat`, when present, is used instead of `cmd` on Windows.
  101. # cmd_bat=[
  102. # 'powershell.exe',
  103. # '-Noninteractive',
  104. # '-Command',
  105. # '& {if (!(Get-Command helm -ErrorAction SilentlyContinue)) {scoop install helm}}'
  106. # ]
  107. # )
  108. # Extensions are open-source, pre-packaged functions that extend Tilt
  109. #
  110. # More info: https://github.com/tilt-dev/tilt-extensions
  111. #
  112. load('ext://git_resource', 'git_checkout')
  113. # Organize logic into functions
  114. # Tiltfiles are written in Starlark, a Python-inspired language, so
  115. # you can use functions, conditionals, loops, and more.
  116. #
  117. # More info: https://docs.tilt.dev/tiltfile_concepts.html
  118. #
  119. def tilt_demo():
  120. # Tilt provides many useful portable built-ins
  121. # https://docs.tilt.dev/api.html#modules.os.path.exists
  122. if os.path.exists('tilt-avatars/Tiltfile'):
  123. # It's possible to load other Tiltfiles to further organize
  124. # your logic in large projects
  125. # https://docs.tilt.dev/multiple_repos.html
  126. load_dynamic('tilt-avatars/Tiltfile')
  127. watch_file('tilt-avatars/Tiltfile')
  128. git_checkout('https://github.com/tilt-dev/tilt-avatars.git',
  129. checkout_dir='tilt-avatars')
  130. # Edit your Tiltfile without restarting Tilt
  131. # While running `tilt up`, Tilt watches the Tiltfile on disk and
  132. # automatically re-evaluates it on change.
  133. #
  134. # To see it in action, try uncommenting the following line with
  135. # Tilt running.
  136. # tilt_demo()