Skip to content

Commit

Permalink
Merge branch 'develop' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
clockworksoul committed Nov 19, 2021
2 parents 770aee5 + 4f28e12 commit cedef65
Show file tree
Hide file tree
Showing 102 changed files with 6,636 additions and 4,976 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ development.yml
.DS_Store

# Our own binary, of course
gort
./gort
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,7 @@ long_description: |-
permissions:
- can_echo

docker:
image: ubuntu
tag: 20.04
image: ubuntu:20.04

commands:
foo:
Expand Down
70 changes: 68 additions & 2 deletions Tiltfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,68 @@
docker_compose('docker-compose.yml')
docker_build('getgort/gort', '.')
# Use `tilt up -- --k8s` to run with Kubernetes.
config.define_bool("k8s",args=False,usage="If set, runs resources under Kubernetes. Otherwise, docker-compose is used.")

args = config.parse()
k8s = "k8s" in args and args["k8s"]

# Build the container image as needed
docker_build('getgort/gort', '.')

# Set up resources using docker-compose
def compose():
docker_compose('docker-compose.yml')

# Pull relay config from development.yml
def loadRelayConfig(devConfig,relayType,setValues):
if relayType in devConfig.keys():
for i in range(len(devConfig[relayType])):
discord = devConfig[relayType][i]
for key in discord:
setValues.append("config.{0}[{1}].{2}={3}".format(relayType,i,key,discord[key]))

def loadDbConfig(devConfig,setValues):
db = devConfig["database"]
for key in db:
value = "config.{0}.{1}={2}".format("database",key,db[key])
setValues.append(value)

setValues = []
if os.path.exists("development.yml"):
devConfig = read_yaml("development.yml")
loadRelayConfig(devConfig,"discord",setValues)
loadRelayConfig(devConfig,"slack",setValues)
loadDbConfig(devConfig,setValues)

# Set up resources using Kubernetes
def kubernetes():
k8s_yaml('tilt-datasources.yaml')
k8s_yaml(
helm(
'./helm/gort',
set = setValues
)
)
k8s_resource('postgres', port_forwards=5432)
k8s_resource('chart-gort', port_forwards=4000)

## Resources to permit common tasks to be run via the Tilt Web UI.

# Bootstrapping the server
local_resource(
"Bootstrap",
"go run . bootstrap https://localhost:4000 --allow-insecure",
trigger_mode=TRIGGER_MODE_MANUAL,
auto_init=False
)

# Clear profiles
local_resource(
"Clear Profiles",
"rm -f ~/.gort/profile",
trigger_mode=TRIGGER_MODE_MANUAL,
auto_init=False
)

if k8s:
kubernetes()
else:
compose()
Loading

0 comments on commit cedef65

Please sign in to comment.