https://kotlinlang.org logo
Channels
100daysofcode
100daysofkotlin
100daysofkotlin-2021
advent-of-code
aem
ai
alexa
algeria
algolialibraries
amsterdam
android
android-architecture
android-databinding
android-studio
androidgithubprojects
androidthings
androidx
androidx-xprocessing
anime
anko
announcements
apollo-kotlin
appintro
arabic
argentina
arkenv
arksemdevteam
armenia
arrow
arrow-contributors
arrow-meta
ass
atlanta
atm17
atrium
austin
australia
austria
awesome-kotlin
ballast
bangladesh
barcelona
bayarea
bazel
beepiz-libraries
belgium
benchmarks
berlin
big-data
books
boston
brazil
brikk
budapest
build
build-tools
bulgaria
bydgoszcz
cambodia
canada
carrat
carrat-dev
carrat-feed
chicago
chile
china
chucker
cincinnati-user-group
cli
clikt
cloudfoundry
cn
cobalt
code-coverage
codeforces
codemash-precompiler
codereview
codingame
codingconventions
coimbatore
collaborations
colombia
colorado
communities
competitive-programming
competitivecoding
compiler
compose
compose-android
compose-desktop
compose-hiring
compose-ios
compose-mp
compose-ui-showcase
compose-wear
compose-web
confetti
connect-audit-events
corda
cork
coroutines
couchbase
coursera
croatia
cryptography
cscenter-course-2016
cucumber-bdd
cyprus
czech
dagger
data2viz
databinding
datascience
dckotlin
debugging
decompose
decouple
denmark
deprecated
detekt
detekt-hint
dev-core
dfw
docs-revamped
dokka
domain-driven-design
doodle
dsl
dublin
dutch
eap
eclipse
ecuador
edinburgh
education
effective-kotlin
effectivekotlin
emacs
embedded-kotlin
estatik
event21-community-content
events
exposed
failgood
fb-internal-demo
feed
firebase
flow
fluid-libraries
forkhandles
forum
fosdem
fp-in-kotlin
framework-elide
freenode
french
fritz2
fuchsia
functional
funktionale
gamedev
ge-kotlin
general-advice
georgia
geospatial
german-lang
getting-started
github-workflows-kt
glance
godot-kotlin
google-io
gradle
graphic
graphkool
graphql
graphql-kotlin
graviton-browser
greece
grpc
gsoc
gui
hackathons
hacktoberfest
hamburg
hamkrest
helios
helsinki
hexagon
hibernate
hikari-cp
hire-me
hiring
hongkong
hoplite
http4k
hungary
hyderabad
image-processing
india
indonesia
inkremental
intellij
intellij-plugins
intellij-tricks
internships
introduce-yourself
io
ios
iran
israel
istanbulcoders
italian
jackson-kotlin
jadx
japanese
jasync-sql
java-to-kotlin-refactoring
javadevelopers
javafx
javalin
javascript
jdbi
jhipster-kotlin
jobsworldwide
jpa
jshdq
juul-libraries
jvm-ir-backend-feedback
jxadapter
k2-early-adopters
kaal
kafka
kakao
kalasim
kapt
karachi
karg
karlsruhe
kash_shell
kaskade
kbuild
kdbc
kgen-doc-tools
kgraphql
kinta
klaxon
klock
kloudformation
kmdc
kmm-español
kmongo
knbt
knote
koalaql
koans
kobalt
kobweb
kodein
kodex
kohesive
koin
koin-dev
komapper
kondor-json
kong
kontent
kontributors
korau
korean
korge
korim
korio
korlibs
korte
kotest
kotest-contributors
kotless
kotlick
kotlin-asia
kotlin-beam
kotlin-by-example
kotlin-csv
kotlin-data-storage
kotlin-foundation
kotlin-fuel
kotlin-in-action
kotlin-inject
kotlin-latam
kotlin-logging
kotlin-multiplatform-contest
kotlin-mumbai
kotlin-native
kotlin-pakistan
kotlin-plugin
kotlin-pune
kotlin-roadmap
kotlin-samples
kotlin-sap
kotlin-serbia
kotlin-spark
kotlin-szeged
kotlin-website
kotlinacademy
kotlinbot
kotlinconf
kotlindl
kotlinforbeginners
kotlingforbeginners
kotlinlondon
kotlinmad
kotlinprogrammers
kotlinsu
kotlintest
kotlintest-devs
kotlintlv
kotlinultimatechallenge
kotlinx-datetime
kotlinx-files
kotlinx-html
kotrix
kotson
kovenant
kprompt
kraph
krawler
kroto-plus
ksp
ktcc
ktfmt
ktlint
ktor
ktp
kubed
kug-leads
kug-torino
kvision
kweb
lambdaworld_cadiz
lanark
language-evolution
language-proposals
latvia
leakcanary
leedskotlinusergroup
lets-have-fun
libgdx
libkgd
library-development
lincheck
linkeddata
lithuania
london
losangeles
lottie
love
lychee
macedonia
machinelearningbawas
madrid
malaysia
mathematics
meetkotlin
memes
meta
metro-detroit
mexico
miami
micronaut
minnesota
minutest
mirror
mockk
moko
moldova
monsterpuzzle
montreal
moonbean
morocco
motionlayout
mpapt
mu
multiplatform
mumbai
munich
mvikotlin
mvrx
myndocs-oauth2-server
naming
navigation-architecture-component
nepal
new-mexico
new-zealand
newname
nigeria
nodejs
norway
npm-publish
nyc
oceania
ohio-kotlin-users
oldenburg
oolong
opensource
orbit-mvi
osgi
otpisani
package-search
pakistan
panamá
pattern-matching
pbandk
pdx
peru
philippines
phoenix
pinoy
pocketgitclient
polish
popkorn
portugal
practical-functional-programming
proguard
prozis-android-backup
pyhsikal
python
python-contributors
quasar
random
re
react
reaktive
realm
realworldkotlin
reductor
reduks
redux
redux-kotlin
refactoring-to-kotlin
reflect
refreshversions
reports
result
rethink
revolver
rhein-main
rocksdb
romania
room
rpi-pico
rsocket
russian
russian_feed
russian-kotlinasfirst
rx
rxjava
san-diego
science
scotland
scrcast
scrimage
script
scripting
seattle
serialization
server
sg-user-group
singapore
skia-wasm-interop-temp
skrape-it
slovak
snake
sofl-user-group
southafrica
spacemacs
spain
spanish
speaking
spek
spin
splitties
spotify-mobius
spring
spring-security
squarelibraries
stackoverflow
stacks
stayhungrystayfoolish
stdlib
stlouis
strife-discord-lib
strikt
students
stuttgart
sudan
swagger-gradle-codegen
swarm
sweden
swing
swiss-user-group
switzerland
talking-kotlin
tallinn
tampa
teamcity
tegal
tempe
tensorflow
terminal
test
testing
testtestest
texas
tgbotapi
thailand
tornadofx
touchlab-tools
training
tricity-kotlin-user-group
trójmiasto
truth
tunisia
turkey
turkiye
twitter-feed
uae
udacityindia
uk
ukrainian
uniflow
unkonf
uruguay
utah
uuid
vancouver
vankotlin
vertx
videos
vienna
vietnam
vim
vkug
vuejs
web-mpp
webassembly
webrtc
wimix_sentry
wwdc
zircon
Powered by
Title
j

jmfayard

04/05/2023, 9:08 AM
👋🏻 Free hosting question, or lack thereof I am working with @Piotr Krzemiński on the #github-workflows-kt open source project, that wants to free the world to have to write YAML for their GitHub Actions. We have a YAML to Kotlin converter that works fine locally. But we are stuck because we would like to host it as a JVM server, and all free hosting plans are gone thanks to all those crypto scammers. For an open source project it’s annoying to have to pay every month for one little converter like that. Can you think of a work-around? like having a nice sponsor, gaining startup credits somewhere or something like that
d

dave

04/05/2023, 9:11 AM
v

Vampire

04/05/2023, 9:13 AM
Who said that all free services are gone?
And several others too still provide free hosting
For small needs
j

jmfayard

04/05/2023, 9:14 AM
@Nikky told me he was traumatized by Oracle’s bad UX
d

dave

04/05/2023, 9:14 AM
I mean you can use lambda to get you a reasonable amount of free calls - it's not quick for sure, but it will work
v

Vampire

04/05/2023, 9:14 AM
bad UX != not free anymore 😄
But I never used the oracle cloud
d

dave

04/05/2023, 9:14 AM
I can confirm that it suuuuuuccccckkkks
😉
j

jmfayard

04/05/2023, 9:15 AM
Fly sounds interesting, do you have a good experience with it David?
v

Vampire

04/05/2023, 9:15 AM
j

Johann Pardanaud

04/05/2023, 9:16 AM
Fly is really good, I would recommend this hosting provider!
d

dave

04/05/2023, 9:16 AM
@jmfayard apart from developing the serverless stuff for http4k, no I don't. TBH if it's supported by pulumi, then it's probably reasonably hands off.
j

jmfayard

04/05/2023, 9:17 AM
Amazing, thanks to all
d

dave

04/05/2023, 9:17 AM
Fly is more like a heroku-type deal - it's more of a PaaS than AWS etc.
j

jmfayard

04/05/2023, 9:17 AM
d

dave

04/05/2023, 9:17 AM
@jmfayard are you just in search of "an API on the internet"?
j

jmfayard

04/05/2023, 9:19 AM
We need a webtool like this, with YAML from GitHub actions on the right, and Kotlin in the left side instead of JSON, and the converting being already written in Kotlin. Goal is that the user doesn’t need to install the converter. https://www.json2yaml.com/
Might be a good occasion to try out http4k to be honest
d

dave

04/05/2023, 9:24 AM
that's always the correct answer... 😉
c

CLOVIS

04/05/2023, 9:25 AM
If you want to go the bootleg route, I'm sure you can use the Kotlin Playground for that 😅 Provide a link to the user with the entire code and a "replace this string by your yaml file"
d

dave

04/05/2023, 9:25 AM
TBH, if you can afford $7 a month then you can use the basic plan on heroku. that's what we use for the http4k toolbox and it works pretty well.
j

James Richardson

04/05/2023, 9:26 AM
I use hetzner for projects that i need to be very cheap. they have a EUR4/month.
c

CLOVIS

04/05/2023, 9:26 AM
If it's for the github-workflows project, why do you need an external service though? Presumably, the user has GitHub Actions enabled, why not just use that?
j

jmfayard

04/05/2023, 9:28 AM
The user should need to to download the project and a run a weird Gradle command to get started imho
Copy paste your YAML, download the KTS script, commit
v

Vampire

04/05/2023, 9:37 AM
You confused people my mixing up sides above. 😉 You said you want it like json-to-yaml, with Kotlin on the left. Not with Yaml on the left and producing the Kotling script. 🙂
If you assume that uses have Kotlin ready to use, you could though just provide a small bootstrapping
.main.kts
instead, that you download to your workflows directory and execute. That will then convert all Yaml files in there and optionally destroy itself afterwards. This way you don't need any online service at all.
Or as a function within the project or in a separate artifact, so that a new user creates a new
test.main.kts
script for a
test.yaml
, copies in a 2-line script which consist of the
@Depend
and one bootstrap line, then executes it which will read and convert the Yaml, and write the result to itself. (If that works properly for example on Windows)
p

Piotr Krzemiński

04/05/2023, 9:47 AM
another idea: an IDE plugin that would perform the whole conversion using a single action. Disadvantage: it’s IDE-dependent, and what Björn proposed above would work even with bare Kotlin compiler + well, JRE
d

dave

04/05/2023, 9:48 AM
IntelliJ plugin development .... 😱 . 😂
p

Piotr Krzemiński

04/05/2023, 9:50 AM
tried it once, https://github.com/JetBrains/intellij-platform-plugin-template does a pretty good job by bootstrapping stuff 🙂
not pushing too much in this direction, though. Maybe an easy-to-install CLI would also do the job, see Create a Kotlin CLI to improve overall developer workflow. Maany ways to approach this
d

dave

04/05/2023, 9:53 AM
The APIs for plugin development (last time I tried it) weren't exactly a joy to work with. Plus writing tests for it is pretty hard
p

Piotr Krzemiński

04/05/2023, 10:04 AM
@jmfayard have you considered free tier in e.g. AWS? https://aws.amazon.com/lambda/ if we could just disable the service once we exceed 1 million YAML -> Kotlin conversions per month (😂 ), it could work
j

James Richardson

04/05/2023, 10:13 AM
Its a great discussion... about how to host a "simple" service. AWS gets surprisingly complex very quickly. IAM + STS, 2FA, Cloudwatch, Pulumi, API GW etc etc. Don't get me wrong, I've run some big services on AWS, but there is a big surface area. Heroku was good. Fly, never tried...
p

Piotr Krzemiński

04/05/2023, 10:14 AM
yeah, I have some production-grade experience with AWS as well, but this simple service would allow us to remove many components you mention form the picture. Like auth, probably not needed. Metrics - nice to have, not strictly needed. API gateway - yeah, it’s a question if the lambda’s “internal-looking” URL would be acceptable and if it can change at any time or not
j

jaguililla

04/05/2023, 10:20 AM
A while ago I was searching for hostings with free tiers myself, and I found these: • https://render.comhttps://railway.apphttps://fly.io Also, DigitalOcean have an Open Source sponsoring plan which gives you 5$/month if your project has 500 stars on GitHub, if I recall correctly.
d

dave

04/05/2023, 10:26 AM
With lambda it's the cold start that's problematic. Of course, if you go with graalvm then you can elliminate some of that, but if you're doing reflectomagic then that's awkward to setup. If you used Moshi + reading into maps then that would be easier because there isn't reflection 🙂
p

Piotr Krzemiński

04/05/2023, 10:27 AM
I claim even 30-second cold start for this particular use case is bearable
or, the library will get insanely popular and the service will be always “warm” 👀 😂 then we’ll need a sponsor
d

dave

04/05/2023, 10:30 AM
We have a total guide to deploy http4k to lambda from scratch with graalvm here 🙂
e

Emil Kantis

04/05/2023, 11:02 AM
Can't you run the Yaml -> kotlin conversion script as Kotlin/JS which you just embed? Then it'll run in the JS engine in the browser? 🙂
p

Piotr Krzemiński

04/05/2023, 11:03 AM
it would require rewriting typesafegithub/github-workflows-kt/script-generator which currently depends on JVM in several ways (KotlinPoet and kaml are JVM-only, plus we use JVM reflection). But yeah, despite the effort, it’s still an option
a

Adam S

04/05/2023, 11:15 AM
personally I gave up on trying to wrangle with online hosting and I bought a small Intel NUC for hosting my projects at home, and I use Docker Compose + Traefik. It’s really interesting reading about the options though.
wacky idea: what about writing a GitHub Action that will create a PR with the converted files?
p

Piotr Krzemiński

04/05/2023, 11:35 AM
we thought of that - the question is how would look like from user’s perspective. They would need to add a temporary GH workflow right?
a

Adam S

04/05/2023, 11:38 AM
yes, so it would be more work for users. Good point. I was thinking about how Renovate works - that can make PRs without a workflow. But I guess that’s running on a server! Plus it requires allowing access and configuring permissions… which is probably too much hassle.
p

Piotr Krzemiński

04/05/2023, 11:39 AM
yes, for Renovate it’s one-time configuration for long-term benefits, here we want to have a tool for one-time use
j

jmfayard

04/05/2023, 11:39 AM
I think nothing beats a web tool for trying out something quickly.
a

Adam S

04/05/2023, 11:39 AM
agreed
j

jmfayard

04/05/2023, 11:40 AM
Keep in mind that not all our potential users are kotlin/Java devs. Everyone who hates to code in YAML is welcome. I would gladly use the project if it used typescript/python/whatever
d

dave

04/05/2023, 12:17 PM
In order to create a PR you need a token with write access to the entire repo. that's challenging from a security perspective
p

Piotr Krzemiński

04/05/2023, 12:34 PM
true, we need something less invasive. A Web app would be great UX-wise
v

Vampire

04/05/2023, 12:35 PM
In order to create a PR you need a token with write access to the entire repo. that's challenging from a security perspective
While I also think a workflow is bad for a one-time action, this point should not be true?
GITHUB_TOKEN
should be able to create a PR as long as it is not running a pull-request build, shouldn't it?
p

Piotr Krzemiński

04/05/2023, 12:36 PM
I know about these settings for Actions. The checkbox is disabled by default
By default it does have read/write, but in many environments that will be locked down
v

Vampire

04/05/2023, 12:40 PM
ah, ok
j

James Richardson

04/05/2023, 1:30 PM
you can clone it and make an upstream PR? (not tried it, just a guess)
p

Piotr Krzemiński

04/05/2023, 1:45 PM
@jmfayard how about trying to apply for https://www.digitalocean.com/open-source/credits-for-projects? they mention 100+ stars for “tier: testing” (whatever it means)
v

Vampire

04/05/2023, 1:50 PM
I guess the tier just identifies the amount of credit you get. With 60$ per year that is 5$ per month. That's enough for one droplet of smallest size (4$ per month) running 24/7 which probably is enough for your use-case. But if you for example would need a database instance too, or mutliple load-balanced instances or similar, the testing tier would not give you enough credit.
m

mbonnin

04/05/2023, 1:51 PM
I've been using Google app engine for small apps. The UX sucks and you get "only" 256MB of RAM which the JVM will happilly use to store metaspace and what not. But it's free has a free tier and it works
d

dave

04/05/2023, 1:55 PM
256Mb is plenty for an http4k app BTW 😉 .
Well - 256m of heap - 🙂
m

mbonnin

04/05/2023, 1:56 PM
Nice!
My Spring Boot app regularly reboots because of Oom but I have never really investigated the reasons why
It "just" reboots, no pb😅
j

James Richardson

04/05/2023, 1:59 PM
one of the very nice, and somewhat underappreciated things that http4k does, is start up really fast! - 100ms for a production server is just normal - even with all the things.
for me this is a huge - when you deploy a bunch of things, you can get to a fully deployed state so quickly, even waiting for the health checks to pass.
also, dev iteration time ftw.
p

Piotr Krzemiński

04/05/2023, 2:00 PM
before we start enjoying the fast startup, we need a place to deploy the app 😉
m

mbonnin

04/05/2023, 2:02 PM
If you want an example of deploying to appengine, I have one here. There's ok-ish Gradle support so you can deploy quite easily
d

dave

04/05/2023, 2:03 PM
@Piotr Krzemiński you may well be able to take advantage of a low-RAM freebie - not enough for a cryptominer but enough for you maybe 🙂
you could even host react stuff and serve it statically from the classpath if you wanted to do an entire JS toolchain.
(but handlebars would probably do!)
v

Vampire

04/05/2023, 2:05 PM
An entire JS toolchain that uses JVM-only dependencies? Impressive, how to do that? 😄
p

Piotr Krzemiński

04/05/2023, 2:05 PM
@Vampire GWT! sorry, it works only with Java
d

dave

04/05/2023, 2:05 PM
if you wanted to do "log in with github", you could also maybe use the API to let the use select projects or do it automatically by looking up using the API
GWT!
#shudders
p

Piotr Krzemiński

04/05/2023, 2:16 PM
I think we need a summary of options here, with pros and cons; this thread is/was a great brainstorming session. @jmfayard let me know if you want to prepare one, otherwise I’ll probably do it
j

jmfayard

04/05/2023, 2:49 PM
ok will try
d

dave

04/05/2023, 3:26 PM
feel free to tag me as
@daviddenton
and james as
@time4tea
in that issue btw 🙂
j

jmfayard

04/05/2023, 3:35 PM
also shared in #feed because cool discussion
p

Piotr Krzemiński

04/05/2023, 5:54 PM
I feel attracted to trying out http4k on this use case :)
j

jmfayard

04/05/2023, 5:55 PM
Me too but that's not my fault, they made such a great presentation at kotlinconf
d

dave

04/05/2023, 7:10 PM
@jmfayard I'm afraid that was a while ago... too long! But you also only have to wait 8 days to see the sequel. It's been a while in the making and we can promise you something that may well make your head 🤯. 😉
e

ephemient

04/06/2023, 1:49 PM
if porting to JS is too much work, there's always things like https://leaningtech.com/cheerpj/ or https://www.teavm.org/. then your JVM bytecode runs on the client and you only need static hosting
v

Vampire

04/06/2023, 1:53 PM
o_O
e

ephemient

04/06/2023, 1:53 PM
v

Vampire

04/06/2023, 1:54 PM
Interesting, but I guess it also has limitations, like reflection not working?
e

ephemient

04/06/2023, 1:55 PM
CheerpJ supports reflection
v

Vampire

04/06/2023, 1:55 PM
Nice, TIL
p

Piotr Krzemiński

04/06/2023, 1:56 PM
what’s the catch? why isn’t it more popular? is it free to use? 🤔
e

ephemient

04/06/2023, 1:57 PM
CheerpJ isn't free. TeaVM is, but has some limitations
v

Vampire

04/06/2023, 1:57 PM
At least TeaVM seems to only support certain APIs
e

ephemient

04/06/2023, 1:58 PM
it's enough enough for some Kotlin projects
v

Vampire

04/06/2023, 1:58 PM
Yeah, definitely worth a try. TeaVM is ASLv2 licensed
From the pricing page it looks like CheerpJ needs a hosted runtime though, either self-hosted or cloud-hosted.
e

ephemient

04/06/2023, 2:06 PM
https://docs.leaningtech.com/cheerpj/Frequently-Asked-Questions "The CheerpJ runtime library is hosted by us on a dedicated CDN-backed domain, and we invite users to link to it in order to take advantage of caching and cross-application resource sharing."
actually I hadn't realized the community tier was "free"
v

Vampire

04/06/2023, 2:08 PM
Well, it says only for testing, but well, ... 😄
e

ephemient

04/06/2023, 2:08 PM
on another note, is porting to Kotlin/JS really that difficult? the only JVM dependency I see is SnakeYAML, and perhaps https://github.com/Him188/yamlkt could fill that role
p

Piotr Krzemiński

04/06/2023, 2:09 PM
also KotlinPoet and JVM reflection
we’re talking about porting this project
e

ephemient

04/07/2023, 7:12 AM
ah, I looked at "library" earlier
not sure what reflection you're using but https://github.com/square/kotlinpoet/issues/304 may be in the future
p

Piotr Krzemiński

04/07/2023, 7:20 AM
thanks, I was about to create the request myself. I’ve added a comment
e

ephemient

04/07/2023, 9:50 AM
kotlinpoet is usually discussed in #squarelibraries
p

Piotr Krzemiński

04/07/2023, 9:51 AM