Compare commits

..

2 Commits

Author SHA1 Message Date
e8483662e1 debug code push 2024-08-20 10:38:38 -03:00
33c95bca6b Switching the crystal functions to faaso 2024-08-20 10:33:21 -03:00
8 changed files with 41 additions and 43 deletions

1
.gitignore vendored
View File

@@ -1,3 +1,4 @@
.faaso.yml
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]

View File

@@ -1,5 +0,0 @@
---
hosts:
https://faaso-prod.ralsina.me/admin/:
- admin
- Neih4ziefioshihaezu3Rienga7baeng

View File

@@ -4,13 +4,16 @@ require "pg"
require "pool/connection"
# get credentials from secrets
USER = File.read("/secrets/user").strip
PASS = File.read("/secrets/pass").strip
DBHOST = File.read("/secrets/dbhost").strip
USER = File.read("secrets/user").strip
PASS = File.read("secrets/pass").strip
DBURL = "postgres://#{USER}:#{PASS}@#{DBHOST}:5432/nombres"
puts "Connnecting to #{DBURL}"
# Create a connection pool to the database
pg = ConnectionPool.new(capacity: 5, timeout: 0.01.seconds) do
PG.connect("postgres://#{USER}:#{PASS}@pinky:5432/nombres")
PG.connect(DBURL)
end
def normalize(s : String) : String

View File

@@ -1,11 +1,11 @@
name: busqueda
runtime: kemal
options:
shard_build_options: "--release"
shard_build_options: "-d --error-trace"
ship_packages: []
devel_packages: []
healthcheck_options: "--interval=1m --timeout=2s --start-period=2s --retries=3"
healthcheck_command: "curl --fail http://localhost:3000/ping || exit 1"
copy_from_build:
- "public public"
- "bin/funko ."
- "bin/funko ."

View File

@@ -1,5 +1,27 @@
#!/bin/sh -x
set -e
export OPENFAAS_URL=http://pinky:8082
pass faas.ralsina.me | faas-cli login -u admin --password-stdin
faas-cli deploy -f functions.yml $*
#export OPENFAAS_URL=http://pinky:8082
#pass faas.ralsina.me | faas-cli login -u admin --password-stdin
#pass iol-pass | faas-cli secret create iol-pass
#pass iol-user | faas-cli secret create iol-user
#pass iol-api-secret | faas-cli secret create iol-api-secret
#pass nombres-user | faas-cli secret create nombres-user
#pass nombres-pass | faas-cli secret create nombres-pass
#faas-cli deploy -f functions.yml $*
export FAASO_SERVER=http://rocky:8888/admin
pass faaso-rocky | faaso login
pass nombres-user | faaso secret -a historico user
pass nombres-pass | faaso secret -a historico pass
echo "192.168.0.98" | faaso secret -a historico dbhost
faaso build busqueda
faaso scale busqueda 0
faaso scale busqueda 1
pass nombres-user | faaso secret -a busqueda user
pass nombres-pass | faaso secret -a busqueda pass
echo "192.168.0.98" | faaso secret -a busqueda dbhost
faaso build historico
faaso scale historico 0
faaso scale historico 1

View File

@@ -3,36 +3,10 @@ provider:
name: openfaas
gateway: http://pinky:8082
functions:
# busqueda:
# lang: python3-flask
# handler: ./busqueda
# image: ralsina/nombres_busqueda:latest
# historico:
# lang: python3-flask
# handler: ./historico
# image: ralsina/nombres_historico:latest
tapas:
lang: python3-flask
handler: ./tapas
image: ralsina/tapas:latest
c-historico:
lang: crystal-http
handler: ./c-historico
image: ralsina/c-historico:latest
build_args:
ADDITIONAL_PACKAGE: gnuplot
secrets:
- nombres-pass
- nombres-user
c-busqueda:
lang: crystal-http
handler: ./c-busqueda
image: ralsina/c-busqueda:latest
build_args:
ADDITIONAL_PACKAGE: gnuplot
secrets:
- nombres-pass
- nombres-user
iol:
lang: python3-fastapi
handler: ./iol

View File

@@ -4,13 +4,16 @@ require "pg"
require "pool/connection"
# get credentials from secrets
USER = File.read("/secrets/user").strip
PASS = File.read("/secrets/pass").strip
DBHOST = File.read("/secrets/dbhost").strip
USER = File.read("/secrets/user").strip
PASS = File.read("/secrets/pass").strip
DBURL = "postgres://#{USER}:#{PASS}@#{DBHOST}:5432/nombres"
puts "Connnecting to #{DBURL}"
# Create a connection pool to the database
pg = ConnectionPool.new(capacity: 5, timeout: 0.01.seconds) do
PG.connect("postgres://#{USER}:#{PASS}@database:5432/nombres")
PG.connect(DBURL)
end
# Connect to the database and get information about

View File

@@ -1,7 +1,7 @@
name: historico
runtime: kemal
options:
shard_build_options: ""
shard_build_options: "-d --error-trace"
ship_packages: []
devel_packages: []
healthcheck_options: "--interval=1m --timeout=2s --start-period=2s --retries=3"