Im having some trouble filling my DB when installing a kar on karaf (Im using liquibase). Im using windows 10, but using linux containers in docker, karaf 4.2.1 and mysql 5.7
There are the steps I did:
1-Went to task manager and stoped the mysql service.
2-Created and run a mysql 5.7 container doing the following:
docker run --name mysql-container -p 3306:3306 -e MYSQL_ROOT_PASSWORD=root -d mysql:5.7
Connected using 127.0.0.1 root/root in heidiSql and created the required DB's so when installing the kar liquibase will fill them with data.
3-Copied the kar to the repo folder in my karaf folder, added the folder to .tar, and then to gzip (.tar.gzip)
4-Created my karaf container using:
.\build.sh --from-local-dist --archive apache-karaf-with-kar.tar.gz
5-Did run karaf in the background:
docker run -d -p 127.0.0.1:8101:8101 --name=karaf-container karaf
Now I used putty and ssh to connect to karaf - localhost:8101. enter the user karaf and pass karaf. All ok, I do the kar:install command, kar install but the bundles are in grace period. I go to heidiSql and see that the DB's are not filled with data.
I go back to karaf connection, do a feature:refresh and i get erros like:
Error resolving artifact org.ops4j.pax.transx:pax-transx-features:xml:features:0.3.0: [Could not transfer artifact org.ops4j.pax.transx:pax-transx-features:xml:features:0.3.0 from/to central (http://repo1.maven.org/maven2/): Failed to transfer file: http://repo1.maven.org/maven2/org/ops4j/pax/transx/pax-transx-features/0.3.0/pax-transx-features-0.3.0-features.xml. Return code is: 501 , ReasonPhrase:HTTPS Required.]
I suposse the problem here is that somehow my connection to mysql doesn't work. After some time the ssh connection is lost (I suposse this is normal if I dont do anything for some time there).
I tried to create a mysql-server container instead, but that way im not even able to connect using heidiSql.
Adicional question: 1-Where do I find the link to the kubernetes dashboard? I cant find it on docker. 2-I was having a first error when trying to docker run karaf:
\"karaf\": executable file not found in $PATH": unknown.
I resolved that because I realised that my karaf folder had less files than a downloaded binary one. Basically the files are the files you see when you open the folder, the build.md, license, etc... So I did copy paste to my folder of those files and I was able to run it. Im asking, because its still a mystery to me...
Thanks for your attention
edit: tried stoping the mysql-container and started mysql from the task manager and its the same, now im sure that for some reason its not connecting to the DB's. so I guess the problem is when I create a karaf container, maybe im missing some configurations. gonna keep trying
After 2 days I finally found the problem.
First, let me say that I did try too to create a network
docker network create mynet
and used the tag docker run --network=mynet
in both mysql-container and karaf-container.
In my hook, I did try to replace localhost with mysql-container:3306 and even after that it didn't work.
Anyway, to resolve, I did what I said above, plus create a new super user:
docker exec -it mysql-container mysql -u root -p
CREATE USER 'user'@'localhost' IDENTIFIED BY 'pass';
GRANT ALL PRIVILEGES ON *.* TO 'user'@'%';
FLUSH PRIVILEGES;
And after that, all worked fine.
I will leave here a usefull link that was kinda hard to find but it has pretty good info: https://codebeamer.com/cb/wiki/5854748
plus, for the 2 extra questions I asked: 1- Still didnt find the kube dashboard, didn't look much for it yet to be honest. 2- For what I have seen in the build.sh it will search a specific folder name 'apache-karaf', so I think this error here happens if you rename your folder and it doesnt match with the build.sh.