Building a Config Service in Go | Home Automation #03

Поделиться
HTML-код
  • Опубликовано: 30 авг 2018
  • Learn how to think like a Computer Scientist at brilliant.org/jakewright
    This is a bit of a lengthy video where I build the entire config service in golang. The config service will simply return another service's config over through an HTTP endpoint. Let me know if this is too long - might need to rethink how I do these videos in future.
    The code from this video:
    github.com/jakewright/tutoria...
    The actual home automation repo:
    github.com/jakewright/home-au...
    ----------------------------------------
    4K CAMERA amzn.to/2EGMQRi
    MICROPHONE amzn.to/2B0KqKS
    CHEAPER MIC amzn.to/2EGFZHo
    VLOGGING CAMERA amzn.to/2EGqGhZ
    SMALLER CAMERA amzn.to/2EHMPg7
    LED LIGHT amzn.to/2AZgMpB
    TINY LIGHT amzn.to/2B0KJFx
    SOCIAL MEDIA
    twitter / jakewrightuk
    facebook / jakewrightuk
    instagram / jakewrightuk
    snapchat jakewrightuk
    jakewright.net
  • НаукаНаука

Комментарии • 73

  • @kojcelkelesh
    @kojcelkelesh 2 месяца назад

    It's very rare to find videos like these, I am just starting out with Go after doing web development for more than 10 years (PHP and JS) and I subscribed to your channel. Thank you!

  • @DrExpresso
    @DrExpresso 5 лет назад +5

    Always nice to see errors and your train of thought for fixing them, great video

  • @FloWmo619
    @FloWmo619 5 лет назад +4

    I love this series! Am a total noob at coding, but your project is exactly what I wanna achieve for my home. So for me this is very very interesting and I'm hoping to be able to use some of your code on github for my own home automation system at some time in the future. Already excited for the next video 😊👍

  • @bertsloan1891
    @bertsloan1891 5 лет назад +2

    Please continue the series on this. It is very interesting, and I love the content!

  • @AmauryOrtega
    @AmauryOrtega 5 лет назад

    Great quality, doesn't matter if you can't post videos regularly, when you do they're 🔥. I couldn't helped but think on why you weren't using consul for this, this is its main use case but then I remembered you wanted to do everything so congrats for doing it

  • @TheLegendSpeaker
    @TheLegendSpeaker 5 лет назад

    Hey man, a lot of us have been following your journey and would love more vlogs! Thanks and Keep it Up!

  • @lusthateenvy
    @lusthateenvy 5 лет назад +1

    This is a good use case for Chef. Perfect for central config management. You can provision all of your RaspPis/containers with their respective apps, and drop their config files locally or populate envars with one command. You could even write a microservice to interact with Chef (using sous chef) and a web frontend to manage configs/envars, deploy new versions of your microservice, etc.

  • @ldt1854
    @ldt1854 5 лет назад +1

    am coming from that video of PHP .. you posted it 5 years ago .. man !! you killed it .. big up ..

  • @Berryss
    @Berryss 5 лет назад +9

    Glad to see another video of the series

    • @pawelb2109
      @pawelb2109 5 лет назад +1

      Glad to see another video.

  • @TheOisannNetwork
    @TheOisannNetwork 5 лет назад

    I love that you explain the code you write. I like Go, but I don't use it enough to know all the small things yet. Swift is pretty similar to Go, but not enough :D

  • @lrnmd
    @lrnmd 5 лет назад +31

    *doesn't even know what does one call the **_thing_** you write the codes on*
    *watches and frankly finds the home automation series entertaining anyway*

  • @Herman-ge2ux
    @Herman-ge2ux 5 лет назад

    Love the series!! Keep up the good work, Jack!

  • @coderanger75
    @coderanger75 4 года назад +17

    "something that sits in the background all the time" you are looking for the word "daemon"

  • @simonarcher1510
    @simonarcher1510 5 лет назад

    Excellent job sir. Both educational and interesting! Keep it up.

  • @josegaspar1978
    @josegaspar1978 Год назад

    Greetings from Portugal.
    I only found you yesterday and I'm already a big fan of your videos.
    I have a little challenge for you :) What about adding golang tests to your code?
    Great job.

  • @aiiaznsk8er
    @aiiaznsk8er 4 года назад

    This is a wonderful video. thanks for doing this series.

  • @shreyasjamadagni4583
    @shreyasjamadagni4583 5 лет назад

    LOVE THIS SERIES!!!!! PLEASE POST MORE

  • @ChristosLouridas
    @ChristosLouridas 4 года назад

    Hey I just got into learning html with your older vids you did very helpful btw :) Really enjoying watching them and learning. What editor are you using for mac tho? I will go on vacation and I thought to take my mac with me and learn some stuff on the go why not? Any recommendations jake? (Maybe free ones for starters/ noobs ? :P ) Would appreciate your answer on that one cheers have a good one.

  • @chamithjanaka6040
    @chamithjanaka6040 5 лет назад

    Ah finally you're back.

  • @esmeraldaescamilla227
    @esmeraldaescamilla227 5 лет назад +2

    saludos Jack ,desde Veracruz, México !!!

  • @Oswee
    @Oswee 5 лет назад +1

    Tnx for sharing idea. Will try to refactor this to run as gRPC API

  • @roblovett8631
    @roblovett8631 5 лет назад

    Hi Jake,
    love your vids. They're pretty pacy but you always explain things so well, so I can always pause and backtrack to make sure I've got it right.
    Can you do one Hass.io? It looks like a great home automation solution. Cheers Rob.

  • @edika32
    @edika32 5 лет назад

    Really nice video! Is there a reason you didn't want to use system events, for example inotify?

  • @user-xc1rc8ue9s
    @user-xc1rc8ue9s 5 лет назад +5

    03:37 "not gonna say lets go" 😂😂😂so funny and u looking cute Jake

  • @CoskunCaner
    @CoskunCaner 5 лет назад +1

    thanks for the series.. i am getting error while importing from "github.com/..../domain" it can not find package, it tries to load (from $GOROOT) and (from $GOPATH) . is there anyway to import this package from workspace/sub-dir, like we did in the python before.

  • @SirHackaL0t.
    @SirHackaL0t. 4 года назад

    Most interesting... One question... Would it be beneficial to monitor the config file and reload when it’s changed? That way you don’t have to wait the 30 seconds.
    Cheers!

  • @burhankalu2682
    @burhankalu2682 5 лет назад +24

    Jack you need to be constant bro .

  • @utkbkkg
    @utkbkkg 5 лет назад +1

    nice video

  • @artemkonoplin2143
    @artemkonoplin2143 5 лет назад

    Hi! Which terminal you are using?

  • @Whynot83848
    @Whynot83848 5 лет назад +26

    Where are the vlogs?????

  • @user-xc1rc8ue9s
    @user-xc1rc8ue9s 5 лет назад

    Hello Jake
    Good to see you
    I am in 11 and has taken computer science ur videos gonna help me....
    And m so unlucky i cant go to hostel like you...And come to home for feeling good....
    Staying at home studying isnt good distract from studies....
    BTW Love you Jake ❤

  • @Sayancool123
    @Sayancool123 5 лет назад

    pls continue the series

  • @user-yx4gx8jv2k
    @user-yx4gx8jv2k 5 лет назад

    oh jakey jakey

  • @mikemanders6685
    @mikemanders6685 5 лет назад +1

    How awesome would it be to do the reload, and then use websockets to let the other services know

    • @mikemanders6685
      @mikemanders6685 5 лет назад

      That would also mean that you don't have to restart the other services to make sure they get the changed values

  • @sergii8423
    @sergii8423 5 лет назад

    yay new vid :D

  • @Herman-ge2ux
    @Herman-ge2ux 5 лет назад +2

    Where is the next tutorial?

  • @MMphego
    @MMphego 5 лет назад

    You need to be consistent and committed man, At least ship out a video every 2 weeks or something or just keep us in the loop.

  • @mitotv6376
    @mitotv6376 Год назад

    Nice

  • @xzero01501
    @xzero01501 5 лет назад +1

    On the one hand, this seems like a lot of fun to write.
    On the other... it'd have taken 10% of the time to write it in node.

    • @lego942
      @lego942 5 лет назад

      Dylan Hanner except go is a much faster language

    • @xzero01501
      @xzero01501 5 лет назад

      @@lego942 Performance isn't everything, cost of development time is a real thing. But also not strictly too true anyway. The JIT can do a lot of legwork and oftentimes produces some ridiculously fast code.
      Also for a webserver, node's non blocking nature of file reads means it'd be able to handle more simultaneous requests.

  • @liliaallan12
    @liliaallan12 5 лет назад +4

    Honestly I'm still waiting for a Cooking With Jake video 😭

  • @24u83qyui3yr8932yi3q
    @24u83qyui3yr8932yi3q 4 года назад

    Great video, unfortunately, I am hitting an error. at the 20ish minute mark, when typing c.Readconfig into the main i get this warning from VS Code "cannot use c.ReadConfig (type func(http.ResponseWriter, *http.Request)) as type http.Handler in argument to router.Get:
    func(http.ResponseWriter, *http.Request) does not implement http.Handler (missing ServeHTTP method)"
    Anyone know what this is?

    • @jungir6425
      @jungir6425 3 года назад

      Better late then never, the api changed a bit, after some google your main.go should look like so:
      func main() {
      config := domain.Config{}
      configWorker := worker.ConfigWorker{
      Config: &config,
      Location: "config.yml",
      }
      go configWorker.Watch(time.Second * 3)
      c := controller.Controller{
      Config: &config,
      }
      router := mux.NewRouter()
      router.SkipClean(true)
      router.HandleFunc("/read/{serviceName}", c.ReadConfig)
      http.ListenAndServe(":8080", router)
      }

  • @zeroblue5599
    @zeroblue5599 5 лет назад +1

    Coding is my life 😎

  • @bonny9645
    @bonny9645 5 лет назад

    Hey did you abandoned this project?

  • @TrangNguyen-cs6wv
    @TrangNguyen-cs6wv 5 лет назад

    Jake likes blue and yellow.

  • @user-xc1rc8ue9s
    @user-xc1rc8ue9s 5 лет назад +1

    The video isnt long Jake Study related videos are long

  • @ada9ada9
    @ada9ada9 5 лет назад

    wouldn't it make more sense to use a native file system notifications library instead, to reduce the overall cpu usage? eg. github.com/fsnotify/fsnotify

    • @jakewrightnet
      @jakewrightnet  5 лет назад

      Yes, that's a good idea actually. I might switch to that, though the difference will be negligible in this case since I'm only reading one file every 30 seconds.

  • @danielmraz7746
    @danielmraz7746 5 лет назад

    6:25 I always panic if there's an error

  • @pearsonlucas
    @pearsonlucas 5 лет назад

    This is a really cool topic and you did great work in this video but over all wouldn't Consul (consul.io) be a good option to use. Trying to avoid SPF Consul has the the concept of clusters. Then you can query that however you would like. Since you are using Docker store.docker.com/images/consul. Keep up the great work!

  • @Susensio
    @Susensio 5 лет назад

    Why go?

  • @highlightmix1121
    @highlightmix1121 5 лет назад

    Can you please go unemployed again so we can have more vlogs? Thanks in advance....

  • @Michqel281
    @Michqel281 5 лет назад

    Why are there dislikes for learning new things

  • @ck130599
    @ck130599 5 лет назад

    You should try github.com/ghodss/yaml for reading / writing yaml. It always takes string as key.

  • @ReasonableRadio
    @ReasonableRadio 2 года назад

    Oh god, that GO linter complains if there's no block comment? That's horrendous. I can only imagine the half assed kinds of explanations and gunk that usually leads to

  • @demetriuslewis6750
    @demetriuslewis6750 5 лет назад +2

    I'm so lost :(

  • @mehedihasan8974
    @mehedihasan8974 5 лет назад

    Brother please make a video about cracking

  • @ThatOneOddGuy
    @ThatOneOddGuy 5 лет назад

    Are u a wright descendant

  • @heatwave2379
    @heatwave2379 5 лет назад

    It is hard

  • @isurujn
    @isurujn 4 года назад +2

    One letter variable names. Eesh!

    • @emiliobf4757
      @emiliobf4757 Год назад

      I believe that's idiomatic in Go

  • @bonny9645
    @bonny9645 5 лет назад

    Hi

    • @bonny9645
      @bonny9645 5 лет назад

      I am looking for next update.....

  • @ngddd7384
    @ngddd7384 5 лет назад

    wish u can be my partner..

  • @vinitasharma8271
    @vinitasharma8271 2 года назад

    U r looking younger than me I m 23

  • @sivovdop8208
    @sivovdop8208 5 лет назад

    Hey, bro. First I just wanna to say that my english can be bad... I came from Russian youtuber who was saying that you are making $3000000 per year and have a lot of channels on youtube with personal workers. I just wanna ask you. Is it real? 'cause now our russian youtubers just trying to hype on something and 99% of their videos are fake

  • @bowenwang
    @bowenwang 5 лет назад +7

    Go syntax is ugly