Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hot-Reload for Development #4

Closed
4 tasks done
jeevatkm opened this issue Mar 8, 2017 · 8 comments
Closed
4 tasks done

Hot-Reload for Development #4

jeevatkm opened this issue Mar 8, 2017 · 8 comments
Assignees
Labels
aah Framework scope cli-tool aah CLI tool feature
Projects

Comments

@jeevatkm
Copy link
Member

jeevatkm commented Mar 8, 2017

Goal is to provide hot-reload capabilities for development, so that it helps developer to have fun development.

What is Hot-Reload?

To reflect changes made in Static Files (js, css), View template file and Go Source Code without manual intervention (i.e. manually stopping server and starting the aah server). Instead aah CLI will do monitoring/watch on aah project and does automatic stop, compile and start the aah server.

Design and Implementation

Approach and solution will be done in aah cli tool. It is not applicable for prod environment profile. It highly recommended to build and deploy the archive for production use.

Static Files

aah framework delivers static file using standard library func http.ServeContent, which is by default adds the Last-Modified response header and by default modern web browser does cache the static files locally.

Solution is to prevent cache and deliver file always- (only for dev environment profile)

  • Set these HTTP headers
    • Cache-Control: no-cache, no-store, max-age=0, must-revalidate
    • Expires: 0

Go Source directory, view directory, config directory

Typically every go program gets compiled before the execution. The view template files compiled and stored in memory on server start.

Solution is to reflect code changes - (only for dev environment profile)

  • Monitor files and directories
  • If change event occur then stop the server, recompile and then start the server
  • There are limitation to this, will document it later on.
    * Standard Library Path is not applicable i.e. GOROOT

Will try to bring this feature as early as possible.

  • Static Files
  • View Template Files
  • Go Source Code
  • Config Files
@jeevatkm jeevatkm created this issue from a note in aah Roadmap (Must To Have) Mar 8, 2017
@jeevatkm jeevatkm moved this from Must To Have to Current Iteration in aah Roadmap Mar 9, 2017
@jeevatkm jeevatkm self-assigned this Mar 10, 2017
@jeevatkm jeevatkm added this to the v0.3 Milestone milestone Mar 10, 2017
@jeevatkm jeevatkm modified the milestone: v0.3 Milestone Mar 24, 2017
@jeevatkm jeevatkm moved this from Current Iteration to Must To Have in aah Roadmap Mar 27, 2017
@ghost
Copy link

ghost commented Jun 1, 2017

how long will it take?

@jeevatkm
Copy link
Member Author

jeevatkm commented Jun 1, 2017

@elevenbag Currently I'm working to wrap up v0.6 release. Then I will be targeting this feature for v0.7

Thank you for your interest.

@jeevatkm
Copy link
Member Author

jeevatkm commented Jun 7, 2017

Cleaning up few comments that doesn't belongs to this thread. Anyway conversation took place in another thread.

@ghost
Copy link

ghost commented Jun 9, 2017

I look forward to your good news.

@jeevatkm jeevatkm added this to the v0.7 Milestone milestone Jun 10, 2017
@jeevatkm jeevatkm moved this from Backlog to In Progress in aah Roadmap Jun 10, 2017
@jeevatkm jeevatkm added aah Framework scope cli-tool aah CLI tool labels Jun 12, 2017
@jeevatkm
Copy link
Member Author

I have evaluated fsnotify and watcher library for monitoring file and directory changes.

I believe watcher library would be better fit for aah framework, I have created issue at watcher library radovskyb/watcher#20 to get few clarifications before I start integrating into aah framework.

@adelowo
Copy link
Contributor

adelowo commented Jul 16, 2017

I have used fsnotify before and i can say it is a good fit too..

@jeevatkm
Copy link
Member Author

jeevatkm commented Jul 16, 2017

@adelowo Yes I agree with you, I'm using it too. fsnotify was my first choice then I come across watcher library without using filesystem events.

I will wait for response then we can take final choice.

jeevatkm added a commit to go-aah/tools that referenced this issue Jul 19, 2017
@jeevatkm
Copy link
Member Author

It's done, hooray!

@jeevatkm jeevatkm moved this from In Progress to Done in aah Roadmap Jul 19, 2017
jeevatkm added a commit to go-aah/app-templates that referenced this issue Jul 4, 2018
jeevatkm added a commit that referenced this issue Aug 19, 2018
jeevatkm added a commit that referenced this issue Aug 19, 2018
jeevatkm added a commit that referenced this issue Aug 19, 2018
jeevatkm added a commit that referenced this issue Aug 19, 2018
jeevatkm added a commit that referenced this issue Aug 19, 2018
jeevatkm added a commit that referenced this issue Aug 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
aah Framework scope cli-tool aah CLI tool feature
Projects
aah Roadmap
  
Released to Audience
Development

No branches or pull requests

2 participants