You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
barretthousen/Tiltfile

201 lines
5.9 KiB

print("""
-----------------------------------------------------------------
✨ Starting up Barretthousen stack
-----------------------------------------------------------------
""".strip())
load('ext://helm_resource', 'helm_resource', 'helm_repo')
load('ext://deployment', 'deployment_create')
load('ext://restart_process', 'docker_build_with_restart')
add catawiki catalog sync, DX improvements, ci - drone ci build using kaniko This builds images extremely slowly, I've implemented some custom fixes to the plugin to improve performance but it's still slow to build images. I will try to implement a DinD solution. There are issues in kaniko about this: https://github.com/GoogleContainerTools/kaniko/issues/875 Squashed commit of the following: commit 1fd65ad139c7ac199d0cf793a5dea07ee71a20a9 Author: Adam Veldhousen <adamveld12@gmail.com> Date: Sat Jul 15 18:17:55 2023 -0500 add deploy script commit 075e15f218c0c81c487fa6362bf5efde8a28c4f4 Author: Adam Veldhousen <adamveld12@gmail.com> Date: Sat Jul 15 17:53:24 2023 -0500 bump limits commit 2d45234e7b4d8c30b03ead01da20359e180f5e2a Author: Adam Veldhousen <adamveld12@gmail.com> Date: Sat Jul 15 17:51:19 2023 -0500 sync button in tilt, support syncing all targets simultaneously commit 75e73a1171a6200b159fe17a3fb40d230ff95c8b Author: Adam Veldhousen <adamveld12@gmail.com> Date: Sat Jul 15 17:03:50 2023 -0500 create admin user on startup commit 40cf74560d39e817b9a474b04f86d2677f6217bc Author: Adam Veldhousen <adamveld12@gmail.com> Date: Fri Jul 14 11:14:00 2023 -0500 test more cache commit 1fbbfe7548513185aaad65690b8a4455312bf7f5 Author: Adam Veldhousen <adamveld12@gmail.com> Date: Fri Jul 14 11:11:34 2023 -0500 test tmpfs commit 0f48c098d9c5ab41cd9bb71066a8447910112c21 Author: Adam Veldhousen <adamveld12@gmail.com> Date: Fri Jul 14 11:08:32 2023 -0500 add tmpfs commit d37142cfef1d66a13e66c9d8025b32da04710d63 Author: Adam Veldhousen <adamveld12@gmail.com> Date: Fri Jul 14 11:02:39 2023 -0500 crank verbosity commit 178eb5bc3867f4eb9efe6cf0a3ada2deaf89651e Author: Adam Veldhousen <adamveld12@gmail.com> Date: Fri Jul 14 10:44:08 2023 -0500 bump requests commit b0aa0b39f0ff790c552b37fb3c903bc7af476703 Author: Adam Veldhousen <adamveld12@gmail.com> Date: Fri Jul 14 10:40:04 2023 -0500 test fewer concurrent builds commit 221e378a534d787715c2413019c4f55e65844506 Author: Adam Veldhousen <adamveld12@gmail.com> Date: Thu Jul 13 20:40:18 2023 -0500 test commit 6c03914341dce447251b4fb695fa33c09f2a2858 Author: Adam Veldhousen <adamveld12@gmail.com> Date: Thu Jul 13 19:01:22 2023 -0500 snapshot mode for faster build commit 91c56d430e23477715188591d8af49569aed2dee Author: Adam Veldhousen <adamveld12@gmail.com> Date: Wed Jul 12 22:40:12 2023 -0500 try script commit 4a119c252344ded29d45b850b96261153f512a85 Author: Adam Veldhousen <adamveld12@gmail.com> Date: Wed Jul 12 22:28:41 2023 -0500 test promote commit b1062a40014407872f920e062a02c88c09dc10af Author: Adam Veldhousen <adamveld12@gmail.com> Date: Wed Jul 12 22:26:58 2023 -0500 test commit c06804dfe6c3ca1b2508b2ccbf84cc3b20703c2a Author: Adam Veldhousen <adamveld12@gmail.com> Date: Wed Jul 12 17:47:48 2023 -0500 beta promote and ignore commit 643e104c372e09707f1047ab32ec9d3ceb973fe3 Author: Adam Veldhousen <adamveld12@gmail.com> Date: Wed Jul 12 16:21:39 2023 -0500 tweakies commit 478e65ac70a10940b3f291ecd0e874ce46129412 Author: Adam Veldhousen <adamveld12@gmail.com> Date: Wed Jul 12 16:09:54 2023 -0500 un woops commit 966d48c193b2515bfe43dba778bd5cbf7ae70efc Author: Adam Veldhousen <adamveld12@gmail.com> Date: Wed Jul 12 15:23:08 2023 -0500 woops commit 2829743d17c41189ddf38153f44377015f9972b7 Author: Adam Veldhousen <adamveld12@gmail.com> Date: Wed Jul 12 15:22:03 2023 -0500 test internal routing commit e08e68b8ad1a9fcb0bddef4bb3c09511be795573 Author: Adam Veldhousen <adamveld12@gmail.com> Date: Wed Jul 12 14:07:31 2023 -0500 push images commit 5705bca0687c50e071ddad8feee7372193cb21f2 Author: Adam Veldhousen <adamveld12@gmail.com> Date: Wed Jul 12 13:40:48 2023 -0500 ugh commit 1699b08d5f30af5f3a7b9c3b89400d5d978bb7b8 Author: Adam Veldhousen <adamveld12@gmail.com> Date: Wed Jul 12 13:39:49 2023 -0500 fixup client builds commit 9ec8616ae17cac4701abe5a34de3e3a3b2932ba8 Author: Adam Veldhousen <adamveld12@gmail.com> Date: Wed Jul 12 13:36:36 2023 -0500 update go mods commit 163b25fd67f48d9a09bdf8916d93e5b3f694b969 Author: Adam Veldhousen <adamveld12@gmail.com> Date: Wed Jul 12 02:11:02 2023 -0500 fix fronend builds commit e5cc7d5c792dbb17f751dd47c767c85afac25921 Author: Adam Veldhousen <adamveld12@gmail.com> Date: Wed Jul 12 01:56:08 2023 -0500 resources commit 8088b95c1ec3fa7048618054db06d0d9c790fd64 Author: Adam Veldhousen <adamveld12@gmail.com> Date: Wed Jul 12 01:38:21 2023 -0500 big test commit 38fef91c499f138be706909214e6bce16f6a5b67 Author: Adam Veldhousen <adamveld12@gmail.com> Date: Wed Jul 12 01:26:09 2023 -0500 testicles commit 53baa0a6478a6b2340fc29b6ea175fa4f02a7610 Author: Adam Veldhousen <adamveld12@gmail.com> Date: Wed Jul 12 01:24:50 2023 -0500 testicles commit 16901ec5bb666174e6549e4278994968850433b7 Author: Adam Veldhousen <adamveld12@gmail.com> Date: Wed Jul 12 01:23:38 2023 -0500 testicles commit 3478d4f512b57677a264ada5f2c57a616edf0c3d Author: Adam Veldhousen <adamveld12@gmail.com> Date: Wed Jul 12 01:19:58 2023 -0500 test 2 commit 16298ada7863880dc9830bc99d2e442391b5779c Author: Adam Veldhousen <adamveld12@gmail.com> Date: Wed Jul 12 01:13:53 2023 -0500 more test commit 80524a1d06b1d764b55bed475bf3d5100d1dbc25 Author: Adam Veldhousen <adamveld12@gmail.com> Date: Wed Jul 12 01:09:03 2023 -0500 test commit b9916204dea1f499e66a5fb708d78e474b893105 Author: Adam Veldhousen <adamveld12@gmail.com> Date: Wed Jul 12 00:19:41 2023 -0500 tools image commit 6e414b3a1bcefbbca9912cee30191f0c1c2d5aed Author: Adam Veldhousen <adamveld12@gmail.com> Date: Wed Jul 12 00:00:23 2023 -0500 test commit abb6183e887613ab366734cf589ddb23f22cc0e8 Author: Adam Veldhousen <adamveld12@gmail.com> Date: Tue Jul 11 22:55:58 2023 -0500 added catawiki scrape commit 2643817e9396059d3a2cbb655a6b8fa52896adca Author: Adam Veldhousen <adamveld12@gmail.com> Date: Tue Jul 11 14:40:05 2023 -0500 add catawiki syncer
10 months ago
load('ext://uibutton', 'cmd_button', 'location', 'text_input')
helm_repo('bitnami', 'https://charts.bitnami.com/bitnami', labels=["9-repos"])
helm_repo('traefik', 'https://traefik.github.io/charts', labels=["9-repos"])
helm_repo('grafana', 'https://grafana.github.io/helm-charts', labels=["9-repos"])
helm_resource(
'ingress',
'traefik/traefik',
namespace='barretthousen-local',
flags=[
'--set', 'logs.access.enabled=true'
],
port_forwards=[
port_forward(8000, 8000, name="Traefik HTTP :8000"),
port_forward(9000, 9000, name='Traefik Dashboard', link_path='/dashboard/#/')
],
resource_deps=['traefik'],
labels=["1-ingress"]
)
k8s_resource(
workload='ingress',
labels='1-ingress',
links=[
link(url='http://admin.localhost:8000', name='admin.localhost'),
link(url='http://bh.localhost:8000', name='bh.localhost'),
]
)
helm_resource(
'postgres',
'bitnami/postgresql',
namespace='barretthousen-local',
flags=[
'--set', 'fullnameOverride=bh-db',
'--set', 'auth.enablePostgresUser=true',
'--set', 'auth.postgresPassword=bh-admin',
'--set', 'auth.database=bh',
],
port_forwards=[port_forward(5432, 5432, name='BH DB')],
resource_deps=['bitnami'],
labels=["9-data"]
)
def bh_client(service="", port_forwards=[], labels=['2-services'], deps=['ingress']):
basepath = './src/{}-client'.format(service)
docker_build(
ref='barretthousen/client-{}-client'.format(service),
context=basepath,
dockerfile='./src/Dockerfile.frontend'.format(service),
target='development',
build_args={
"service": '{}-client'.format(service)
},
entrypoint='vite dev --port=80 --host=0.0.0.0 --strictPort --logLevel info',
live_update=[
sync(basepath + '/src', '/opt/{}-client/src'.format(service)),
sync(basepath + '/static', '/opt/{}-client/static'.format(service)),
run('cd {} && npm install'.format(basepath), trigger=[basepath+'/package.json', basepath+'/package.lock.json'])
]
)
k8s_resource(
workload='{}-client-local'.format(service),
port_forwards=port_forwards,
labels=['2-services'],
resource_deps=deps
)
def bh_backend_service(service="", port_forwards=[], migrateDB=False, devMode=True, labels=['2-services'], deps=['postgres']):
local_resource(
'{}-go-compile'.format(service),
'CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -gcflags "all=-N -l" -o .bin/{}-debug ./src/{}'.format(service, service),
deps=['./src/{}'.format(service), './src/lib'],
labels=['3-compilation']
)
# complains about grpc port still being in use, so maybe the service isn't exiting cleanly
entry_cmd = [
'/go/bin/dlv',
'--headless',
'--listen=0.0.0.0:2345',
'--api-version=2',
'--log',
'--accept-multiclient',
'--log-output=rpc',
'exec',
'/opt/{}-debug'.format(service),
'--continue'
]
if migrateDB:
entry_cmd += ['--', '-migrate']
docker_build_with_restart(
ref="barretthousen/service-{}".format(service),
dockerfile="./src/Dockerfile.dev-backend",
context=".",
entrypoint=entry_cmd,
build_args={
"service": service
},
trigger = [
'./.bin/{}-debug'.format(service)
],
only = [
'./.bin/{}-debug'.format(service),
'./src/runner',
'./src/catalog',
'./src/proxy-admin',
'./src/proxy-web',
'./src/lib'
],
live_update=[
sync('./.bin', '/opt'),
sync('./src', '/go/src'),
]
)
k8s_resource(
workload='{}-local'.format(service),
port_forwards=port_forwards,
labels=labels,
resource_deps=deps,
)
k8s_yaml(
kustomize("./env/local")
)
k8s_resource(
workload='runner-sync-local',
labels='2-services'
)
bh_backend_service(service="auth", migrateDB=True, port_forwards=[
port_forward(2345, name='Delve port')
])
bh_backend_service(service="runner", migrateDB=True, port_forwards=[
port_forward(2346, 2345, name='Delve port')
])
bh_backend_service(service="catalog", migrateDB=True, port_forwards=[
port_forward(2347, 2345, name='Delve port')
])
bh_backend_service(service="proxy-admin", port_forwards=[
port_forward(8082, 80, name="HTTP API @ localhost:8082")
], deps=['ingress'])
bh_backend_service(service="proxy-web", port_forwards=[
port_forward(8081, 80, name="HTTP API @ localhost:8081")
], deps=['ingress'])
bh_client(service='web', deps=["proxy-web-local"])
bh_client(service='admin', deps=["proxy-admin-local"])
11 months ago
add catawiki catalog sync, DX improvements, ci - drone ci build using kaniko This builds images extremely slowly, I've implemented some custom fixes to the plugin to improve performance but it's still slow to build images. I will try to implement a DinD solution. There are issues in kaniko about this: https://github.com/GoogleContainerTools/kaniko/issues/875 Squashed commit of the following: commit 1fd65ad139c7ac199d0cf793a5dea07ee71a20a9 Author: Adam Veldhousen <adamveld12@gmail.com> Date: Sat Jul 15 18:17:55 2023 -0500 add deploy script commit 075e15f218c0c81c487fa6362bf5efde8a28c4f4 Author: Adam Veldhousen <adamveld12@gmail.com> Date: Sat Jul 15 17:53:24 2023 -0500 bump limits commit 2d45234e7b4d8c30b03ead01da20359e180f5e2a Author: Adam Veldhousen <adamveld12@gmail.com> Date: Sat Jul 15 17:51:19 2023 -0500 sync button in tilt, support syncing all targets simultaneously commit 75e73a1171a6200b159fe17a3fb40d230ff95c8b Author: Adam Veldhousen <adamveld12@gmail.com> Date: Sat Jul 15 17:03:50 2023 -0500 create admin user on startup commit 40cf74560d39e817b9a474b04f86d2677f6217bc Author: Adam Veldhousen <adamveld12@gmail.com> Date: Fri Jul 14 11:14:00 2023 -0500 test more cache commit 1fbbfe7548513185aaad65690b8a4455312bf7f5 Author: Adam Veldhousen <adamveld12@gmail.com> Date: Fri Jul 14 11:11:34 2023 -0500 test tmpfs commit 0f48c098d9c5ab41cd9bb71066a8447910112c21 Author: Adam Veldhousen <adamveld12@gmail.com> Date: Fri Jul 14 11:08:32 2023 -0500 add tmpfs commit d37142cfef1d66a13e66c9d8025b32da04710d63 Author: Adam Veldhousen <adamveld12@gmail.com> Date: Fri Jul 14 11:02:39 2023 -0500 crank verbosity commit 178eb5bc3867f4eb9efe6cf0a3ada2deaf89651e Author: Adam Veldhousen <adamveld12@gmail.com> Date: Fri Jul 14 10:44:08 2023 -0500 bump requests commit b0aa0b39f0ff790c552b37fb3c903bc7af476703 Author: Adam Veldhousen <adamveld12@gmail.com> Date: Fri Jul 14 10:40:04 2023 -0500 test fewer concurrent builds commit 221e378a534d787715c2413019c4f55e65844506 Author: Adam Veldhousen <adamveld12@gmail.com> Date: Thu Jul 13 20:40:18 2023 -0500 test commit 6c03914341dce447251b4fb695fa33c09f2a2858 Author: Adam Veldhousen <adamveld12@gmail.com> Date: Thu Jul 13 19:01:22 2023 -0500 snapshot mode for faster build commit 91c56d430e23477715188591d8af49569aed2dee Author: Adam Veldhousen <adamveld12@gmail.com> Date: Wed Jul 12 22:40:12 2023 -0500 try script commit 4a119c252344ded29d45b850b96261153f512a85 Author: Adam Veldhousen <adamveld12@gmail.com> Date: Wed Jul 12 22:28:41 2023 -0500 test promote commit b1062a40014407872f920e062a02c88c09dc10af Author: Adam Veldhousen <adamveld12@gmail.com> Date: Wed Jul 12 22:26:58 2023 -0500 test commit c06804dfe6c3ca1b2508b2ccbf84cc3b20703c2a Author: Adam Veldhousen <adamveld12@gmail.com> Date: Wed Jul 12 17:47:48 2023 -0500 beta promote and ignore commit 643e104c372e09707f1047ab32ec9d3ceb973fe3 Author: Adam Veldhousen <adamveld12@gmail.com> Date: Wed Jul 12 16:21:39 2023 -0500 tweakies commit 478e65ac70a10940b3f291ecd0e874ce46129412 Author: Adam Veldhousen <adamveld12@gmail.com> Date: Wed Jul 12 16:09:54 2023 -0500 un woops commit 966d48c193b2515bfe43dba778bd5cbf7ae70efc Author: Adam Veldhousen <adamveld12@gmail.com> Date: Wed Jul 12 15:23:08 2023 -0500 woops commit 2829743d17c41189ddf38153f44377015f9972b7 Author: Adam Veldhousen <adamveld12@gmail.com> Date: Wed Jul 12 15:22:03 2023 -0500 test internal routing commit e08e68b8ad1a9fcb0bddef4bb3c09511be795573 Author: Adam Veldhousen <adamveld12@gmail.com> Date: Wed Jul 12 14:07:31 2023 -0500 push images commit 5705bca0687c50e071ddad8feee7372193cb21f2 Author: Adam Veldhousen <adamveld12@gmail.com> Date: Wed Jul 12 13:40:48 2023 -0500 ugh commit 1699b08d5f30af5f3a7b9c3b89400d5d978bb7b8 Author: Adam Veldhousen <adamveld12@gmail.com> Date: Wed Jul 12 13:39:49 2023 -0500 fixup client builds commit 9ec8616ae17cac4701abe5a34de3e3a3b2932ba8 Author: Adam Veldhousen <adamveld12@gmail.com> Date: Wed Jul 12 13:36:36 2023 -0500 update go mods commit 163b25fd67f48d9a09bdf8916d93e5b3f694b969 Author: Adam Veldhousen <adamveld12@gmail.com> Date: Wed Jul 12 02:11:02 2023 -0500 fix fronend builds commit e5cc7d5c792dbb17f751dd47c767c85afac25921 Author: Adam Veldhousen <adamveld12@gmail.com> Date: Wed Jul 12 01:56:08 2023 -0500 resources commit 8088b95c1ec3fa7048618054db06d0d9c790fd64 Author: Adam Veldhousen <adamveld12@gmail.com> Date: Wed Jul 12 01:38:21 2023 -0500 big test commit 38fef91c499f138be706909214e6bce16f6a5b67 Author: Adam Veldhousen <adamveld12@gmail.com> Date: Wed Jul 12 01:26:09 2023 -0500 testicles commit 53baa0a6478a6b2340fc29b6ea175fa4f02a7610 Author: Adam Veldhousen <adamveld12@gmail.com> Date: Wed Jul 12 01:24:50 2023 -0500 testicles commit 16901ec5bb666174e6549e4278994968850433b7 Author: Adam Veldhousen <adamveld12@gmail.com> Date: Wed Jul 12 01:23:38 2023 -0500 testicles commit 3478d4f512b57677a264ada5f2c57a616edf0c3d Author: Adam Veldhousen <adamveld12@gmail.com> Date: Wed Jul 12 01:19:58 2023 -0500 test 2 commit 16298ada7863880dc9830bc99d2e442391b5779c Author: Adam Veldhousen <adamveld12@gmail.com> Date: Wed Jul 12 01:13:53 2023 -0500 more test commit 80524a1d06b1d764b55bed475bf3d5100d1dbc25 Author: Adam Veldhousen <adamveld12@gmail.com> Date: Wed Jul 12 01:09:03 2023 -0500 test commit b9916204dea1f499e66a5fb708d78e474b893105 Author: Adam Veldhousen <adamveld12@gmail.com> Date: Wed Jul 12 00:19:41 2023 -0500 tools image commit 6e414b3a1bcefbbca9912cee30191f0c1c2d5aed Author: Adam Veldhousen <adamveld12@gmail.com> Date: Wed Jul 12 00:00:23 2023 -0500 test commit abb6183e887613ab366734cf589ddb23f22cc0e8 Author: Adam Veldhousen <adamveld12@gmail.com> Date: Tue Jul 11 22:55:58 2023 -0500 added catawiki scrape commit 2643817e9396059d3a2cbb655a6b8fa52896adca Author: Adam Veldhousen <adamveld12@gmail.com> Date: Tue Jul 11 14:40:05 2023 -0500 add catawiki syncer
10 months ago
createAdminCmd = [
'./hack/create_user.sh', 'admin@barretthousen.com', 'admin', 'ADMINISTRATOR'
]
loginAdminCmd = [
'curl', '-vvvv', '-X POST', '-H "Content-Type: application/json"',
'-d "{\"email\":\"admin@barretthousen.com\", \"password\":\"admin\"}"',
'http://bh.localhost:8000/api/v1/user'
]
syncCatalogsCmd = [
'curl', '-vvvv', '-X', 'PUT',
'-H', 'Content-Type: application/json',
'-H', 'bh-session-id: 2',
'-d', '{\"targetSite\":\"All\"}',
'http://admin.localhost:8000/api/v1/sync'
]
local(createAdminCmd, quiet=False, echo_off=True)
local(loginAdminCmd, quiet=False, echo_off=True)
local(syncCatalogsCmd, quiet=False, echo_off=True)
cmd_button(
name='Sync Catalogs',
argv=syncCatalogsCmd,
text='Sync Catalogs',
location=location.NAV,
icon_name='sync')
11 months ago