Lint/cleanup

This commit is contained in:
Roberto Alsina 2024-06-29 23:16:55 -03:00
parent ce856beaf2
commit 5bb7ac45b3
5 changed files with 2 additions and 20 deletions

View File

@ -1,4 +1,4 @@
require "kemal" require "kemal"
require "./function.cr" require "./funko.cr"
Kemal.run Kemal.run

View File

@ -21,8 +21,5 @@ dependencies:
branch: add_exposed_ports branch: add_exposed_ports
commander: commander:
github: mrrooijen/commander github: mrrooijen/commander
kiwi:
github: ralsina/kiwi
branch: master
kemal: kemal:
github: kemalcr/kemal github: kemalcr/kemal

View File

@ -3,19 +3,12 @@ require "commander"
require "docr" require "docr"
require "docr/utils.cr" require "docr/utils.cr"
require "file_utils" require "file_utils"
require "kiwi/file_store"
require "uuid" require "uuid"
# FIXME make it configurable
REPO = "localhost:5000"
# Functions as a Service, Ops! # Functions as a Service, Ops!
module Faaso module Faaso
VERSION = "0.1.0" VERSION = "0.1.0"
# A simple persistent k/v store
store = Kiwi::FileStore.new(".kiwi")
# Ensure the faaso-net network exists # Ensure the faaso-net network exists
def self.setup_network def self.setup_network
docker_api = Docr::API.new(Docr::Client.new) docker_api = Docr::API.new(Docr::Client.new)
@ -69,11 +62,6 @@ module Faaso
puts "Building function... #{funko.name} in #{tmp_dir}" puts "Building function... #{funko.name} in #{tmp_dir}"
slug = funko.name
# FIXME: this should be configurable
repo = REPO
docker_api = Docr::API.new(Docr::Client.new) docker_api = Docr::API.new(Docr::Client.new)
docker_api.images.build( docker_api.images.build(
context: tmp_dir.to_s, context: tmp_dir.to_s,
@ -94,7 +82,6 @@ module Faaso
def run def run
funkos = Funko.from_paths(@arguments) funkos = Funko.from_paths(@arguments)
funkos.each do |funko| funkos.each do |funko|
repo = REPO
container_name = "faaso-#{funko.name}" container_name = "faaso-#{funko.name}"
docker_api = Docr::API.new(Docr::Client.new) docker_api = Docr::API.new(Docr::Client.new)
# Pull image from registry # Pull image from registry
@ -188,8 +175,6 @@ module Faaso
next next
end end
puts "Container for #{funko.name} is running" puts "Container for #{funko.name} is running"
public_port = containers[0].@ports[0].@public_port
# TODO: Map route in reverse proxy to function
end end
# TODO: Run test for healthcheck # TODO: Run test for healthcheck
# TODO: Return function URL for testing # TODO: Return function URL for testing