fp/t.wip.tiltfile

208 lines
4.9 KiB
Plaintext

# Tiltfile for working with Next and Strapi locally
# load('ext://cert_manager', 'deploy_cert_manager')
# deploy_cert_manager()
load('ext://dotenv', 'dotenv')
dotenv(fn='.env')
# kubefwd all namespaces Tilt deploys to.
v1alpha1.extension_repo(name='default', url='https://github.com/tilt-dev/tilt-extensions')
v1alpha1.extension(name='kubefwd:config', repo_name='default', repo_path='kubefwd')
# v1alpha1.extension_repo(
# name='default',
# url='https://github.com/tilt-dev/tilt-extensions'
# )
# v1alpha1.extension(
# name='ngrok:config',
# repo_name='default',
# repo_path='ngrok',
# )
# args=['--default_config_file=%s' % os.getenv('TILT_NGROK_DEFAULT_CONFIG_FILE')]
# load('ext://helm_remote', 'helm_remote')
# helm_remote(
# 'frp-operator',
# repo_name='frp-operator',
# repo_url='https://zufardhiyaulhaq.com/frp-operator/charts/releases/',
# namespace='futureporn',
# version='1.0.0'
# )
# helm_remote(
# 'kubernetes-ingress-controller',
# repo_name='kubernetes-ingress-controller',
# repo_url='https://ngrok.github.io/kubernetes-ingress-controller',
# namespace='futureporn',
# create_namespace='false',
# set=[
# 'credentials.apiKey=%s' % os.getenv('NGROK_API_KEY'),
# 'credentials.authtoken=%s' % os.getenv('NGROK_AUTHTOKEN')
# ]
# )
k8s_yaml(helm(
'./charts/fp',
values=['./charts/fp/values-dev.yaml'],
))
# docker_build('fp/link2cid', './packages/link2cid')
docker_build(
'fp/strapi',
'.',
build_args={
'NODE_ENV': 'development',
},
only=['./packages/strapi'],
dockerfile='./d.strapi.dockerfile',
live_update=[
sync('./packages/strapi', '/app')
]
)
# docker_build(
# 'fp/strapi-app',
# '.',
# only=["./packages/strapi-app"],
# dockerfile='d.strapi-app.dockerfile',
# live_update=[
# sync('./packages/strapi-app', '/app')
# ]
# )
load('ext://uibutton', 'cmd_button')
# @todo in the future we can add a button for seeding the db from scratch.
# this would be good for onboarding devs
# step 1 would be creating the db
#
# step 2 is ???
#
# set -eu
# # get k8s pod name from tilt resource name
# POD_NAME="$(tilt get kubernetesdiscovery "$resource" -ojsonpath='{.status.pods[0].name}')"
# kubectl exec "$POD_NAME" -- $command
cmd_button('postgres:seed',
argv=['sh', './scripts/postgres-seed.sh'],
resource='postgres',
icon_name='dataset',
text='seed db with schema',
)
cmd_button('postgres:restore',
argv=['sh', './scripts/postgres-restore.sh'],
resource='postgres',
icon_name='cloud',
text='restore db from backup',
)
cmd_button('postgres:drop',
argv=['sh', './scripts/postgres-drop.sh'],
resource='postgres',
icon_name='delete',
text='delete the database'
)
## Uncomment the following for fp/next in dev mode
## this is useful for changing the UI and seeing results
docker_build(
'fp/next',
'.',
only=['./pnpm-lock.yaml', './package.json', './packages/next'],
dockerfile='d.next.dockerfile',
target='dev',
build_args={
'NEXT_PUBLIC_STRAPI_URL': 'http://strapi.futureporn.svc.cluster.local:1339'
},
live_update=[
sync('./packages/next', '/app')
]
)
docker_build(
'fp/scout',
'.',
only=['./pnpm-lock.yaml', './package.json', './packages/scout', './packages/pg-pubsub'],
dockerfile='d.scout.dockerfile',
target='scout',
live_update=[
sync('./packages/scout', '/app')
]
)
# k8s_resource(
# workload='kubernetes-ingress-controller-manager',
# links=[
# link(os.getenv('NGROK_URL'), 'Endpoint')
# ],
# labels='ngrok'
# )
# k8s_resource(
# workload='frp-operator-controller-manager',
# labels='tunnel'
# )
# k8s_resource(
# workload='echo-deployment',
# port_forwards=['8080'],
# links=[
# link('https://echo.piko.sbtp.xyz'),
# link('http://echo.futureporn.svc.cluster.local:8080')
# ],
# labels='debug'
# )
# k8s_resource(
# workload='snake',
# port_forwards=['8080'],
# labels='debug'
# )
# k8s_resource(
# workload='game-2048',
# port_forwards=['8081:8080'],
# labels='debug'
# )
k8s_resource(
workload='next',
port_forwards=['3000'],
links=[
link('http://next.futureporn.svc.cluster.local:3000'),
link('https://next.piko.sbtp.xyz'),
]
)
k8s_resource(
workload='strapi',
port_forwards=['1339'],
links=[
link('http://localhost:1339/admin'),
link('http://strapi.futureporn.svc.cluster.local:1339'),
link('https://strapi.piko.sbtp.xyz'),
]
)
# k8s_resource(
# workload='strapi-app',
# port_forwards=['1338']
# )
k8s_resource(
workload='postgres',
)
k8s_resource(
workload='scout',
port_forwards=['5000']
)
k8s_resource(
workload='postgres',
port_forwards=['5432']
)
k8s_resource(
workload='pgadmin',
port_forwards=['5050']
)