Anyone know where I can find good documentation o...
# ktor
g
Anyone know where I can find good documentation on deploying ktor and a Mysql database on AWS via build pipeline? making progress but its bumpy.
a
do u already have a DB created? how do you want to deploy your services? run in containers ?
g
Hi, THANK YOU!! This is a kotlin js/jvm project that uses gradle and ktor, was trying to merge in my flutter app so all company software was under the same git but that proved futile so I have a separate repo for that. So in ktor I am using Kotlin Exposed to define my tables, relationships, default values and test values. I then have two convient gradle tasks called create Tables and drop Tables that uses exposed to stand up the DB and insert the initial values. All that is done locally and I'm trying to move to CIDI were I can still utilize these gradle DB commands both with a local and remote DB.
Maybe I'm outside convention regarding how ktor expects me to automate DB deployment along with all the other CIDI conventions... why I'm looking for a really solid best practices simple walk thru.
I have connected the AWS pipeline to github, also created build and deploy items in the pipeline. Gihub automatic pull, stage 1, works. Build, stage 2, just runs gradle build via the yml file; parts of it work and other parts don't... I think 3 tests are failing that tests DB communication, which is why I switched gears to try to stand that up preliminary and automatically in the pipeline; those are indicated in the gradle jvmTest subtask when gradle build is run. allTests task is what appears to break it (never figured out why build runs each test task and then, also, allTests... but I think it caused issues locally a while back. Log attached from AWS build. Stage 3, deploy, is pretty much failing... but I am definitely not an expert on deploying java so have a lot to learn.
a
the error
com.mysql.cj.exceptions.CJCommunicationsException
is i guess cause test is not able to connect to DB. can u check if the DB details are passed properly to the test? for running tests in pipeline, you can choose 2 approach. 1. have a test database and try to connect to it. u can clean up the DB, insert test data etc and clean up after test run. (easy but not advisable) 2. use test containers https://www.testcontainers.org/modules/databases/mysql/
g
I stood up a database, but it has no tables.... all the tables are declared by kotlin exposed/ktor, so I think step one is figuring out how to get AWS to build the DB automatically from the exposed DSL declarations
Otherwise I guess I'd convert that to SQL and build it directly with AWS... but then doesn't that defeat the entire purpose of using exposed and ktor, lol?
brb, thaks!
a
i didnt say u should create.
g
yeah, you are right, need to break the problem down more