I was following the instructions for making self signed certs and that all went fine, made the /tmp/Creds directory and copied the keys over to that /tmp/Creds/ location.
When I then went to build and run the server it wouldn’t make a connection. The project built fine, but exited with [ERROR] [Kitura.swift:139 start()] Error listening on port 8080: Certificate chain doesn't exist at specified path.. Use server.failed(callback:) to handle
So I tried to find where the certificates that were actually generated. I finally ended up finding them in a private folder located in the root HD. So basically it was in root/private/tmp/Certs location not root/tmp/Certs.
I’m pretty sure this is why my Server App with Xcode is not working properly.
My question is…if I change the file path in certificateKeyFile it should work again locally with Xcode, but is there a way to check to see if the docker version is also not using the right file path? The errors I’m getting there are [ERROR] [IncomingHTTPSocketProcessor.swift:278 parse] Failed to parse a request. Parsed fewer bytes than were passed to the HTTP parser I’m not sure if I have to change the docker file to the other file path as well. Or maybe there is a config setting with the docker cli I’m not aware of.
So, it sounds like you figured out how to get this working in Xcode. Regarding how you set this up in Docker, you should notice that your Dockerfile includes a change that reads like so:
This is what you do inside the filesystem via Docker to make sure that everything goes to the right place. Try changing this around to see how building and running the application works for this.
I had to re-generate my certs (I had restarted my comp the other day) and again the tmp/Creds folder was created in /private/tmp/Creds. I assume this is because I am logged in as a user and have a separate Admin account that is the “main” user.
This time I just moved the Creds folder with the certs to the actual /tmp file. I had already changed the dockerfile and EmojijournalServer Application.swift files to reflect what’s in the book.
Again the Xcode version worked correctly and was listening on port 8080(delegate: SSLService.SSLService)
The EmojiJournalMobile app was also connecting to the Xcode version correctly over https.
I stopped the Xcode version fo the server and tried to use the kitura build command.
It does not build. It always crashes with an error saying the config variable in Application.swift do not match available overloads. Indeed the SSLConfig method in my app.swift does not even change color like in the #else section of the run() func. I tried to reenter that config variable but the autocomplete has only one overload method so I entered the variable as it is in the book. Then I double checked the code included with the book & it looks the same. So I tried to do a kitura build on the final book version of the code. That one built fine and so did the kitura run it also connects to my version of the EmojiJournalMobile app over https. It also doesn’t seem to have the same errors I was getting with the Health services info.
The only other thing I noticed was that my version of the EmojiJournalServer had 2 additional imports in the Application.swift file when compared to the book version. One for Credentials and one for Credentials HTTP & honestly I don’t recall when I put these in there. I removed those imports and my version of the EmojiJournalServer built & ran in docker just fine. It also connected to my EmojiJournalMobile App fine. Any idea why this might have caused issues?
TBH I’m just happy I’m able to continue to the Kubernetes portion of the book.