SciFiFarms / TechnoCore

TechnoCore: an IoT stack powered by Docker Swarm
GNU General Public License v3.0
20 stars 1 forks source link

Rename and clean up #24

Closed TheHackmeister closed 5 years ago

TheHackmeister commented 5 years ago

This pull request contains a number of one off tasks. Name changes, comment editing, fixes and removals. It also contains a handful of notable changes.

Added files so that anyone using VS Code can easily have the workspace set up. If you open the TechnoCore repo in VS Code, it should ask you if you'd like to open the workspace contained in the folder. Right now all that is configured is the debugging configurations and a workaround for not being able to open nested git repos. Eventually, I'd like to include extension suggestion list.

.env has gotten some love. It now contains $domain, $stack_name, and $image_provider as settings to pass in. All of the scripts now reference .env so that the vars will be consistent across tools. With that said, there is one place in home_assistant_db that uses scifi.farm, and should be set to .local via the TLS cert, or have ${domain} passed in via env and set some how.

Added volume mount paths (live_mount) to allow for toggling of mounting volumes to the dev machine vs using the images files. There wasn't a really easy way to do this, so my solution is a bit wonky. I have 2 lines for each env var. So docs_live_mount="path_to_repo_dir:/container/path" docs_live_mount="./empty/:/opt/.dummy" That way the last one present takes effect. Mounting an empty volume seems a little dumb, but it does allow me to comment them out to reveal the dev mount paths. That way I can toggle it by changing my .env and using --skip-worktree to have git ignore those changes.

$domain: Domain of the services. For example, scifi.farm is the domain in home_assistant.scifi.farm. $stack_name: The name of the stack. I plan on running at least a couple separate stacks. So I could have lettuce_technocore and strawberry_technocore if I wanted.
$image_provider: The organization hosting the TechnoCore images. I think most people will use the default technocore $image_provider, but if someone wanted to setup their own images in their own registry, changing this would allow them to do that.

Finally, I wanted to have secret names namespaced with the $stack_name. I originally tried ${stack_name}_secret_name:, but that caused docker to throw an error. Instead, I found you have to create the secret with a non namespaced name, (portainer_mqtt_username for example), then you can set the $stack_name in the name field: name: ${stack_name}_portainer_mqtt_username.

Developer setup script (utilities/dev-install.sh). This script is for setting up the development environment. It checks out repos into locations that are already ignored by the TechnoCore repo. This structure is needed by the utilities/build.sh script for building images, as well as live_mounts in the .env file.

Previously, deploy STACK_NAME would expect to be ran in a sub dir; technocore/home-assistant for example. It now expects to be called from the root of the TechnoCore repo.