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

Binary resource packaging #156

Closed
pharrisee opened this issue Mar 31, 2018 · 20 comments
Assignees
Projects

Comments

@pharrisee
Copy link

@pharrisee pharrisee commented Mar 31, 2018

Can there be an option at build time to package resources (views, css,js,img and config) into the executable for easy one file deployment?

There are numerous packaging libraries/applications available:

to name but a few.


Updates:

  • Feature implemented, available on edge - command is aah build --single or aah b -s
  • Documentation
@jeevatkm jeevatkm self-assigned this Mar 31, 2018
@jeevatkm jeevatkm added this to v0.11.0 - Iteration in aah Roadmap via automation Mar 31, 2018
@jeevatkm jeevatkm added the aah label Apr 1, 2018
@jeevatkm jeevatkm added this to the v0.11.0 Milestone milestone Apr 6, 2018
@vzool

This comment has been minimized.

Copy link

@vzool vzool commented Apr 6, 2018

This is really hot, anything will be already loaded and fetched directly from RAM.
Applications will behave so fast, we just touch SSD/HDD to write to Database.
Facebook working for many years to reach this goal, this is great stuff.

@jeevatkm jeevatkm moved this from v0.11.0 - Iteration to v0.11.0 - In Progress in aah Roadmap Apr 30, 2018
@pharrisee

This comment has been minimized.

Copy link
Author

@pharrisee pharrisee commented May 1, 2018

Not sure if this helps, but this guy has done a fair bit of research and comparison of various resource embedding methods for Go:

http://tech.townsourced.com/post/embedding-static-files-in-go/

@jeevatkm

This comment has been minimized.

Copy link
Member

@jeevatkm jeevatkm commented May 1, 2018

@pharrisee Thank you, sure I will read it. I'm currently doing my homework; every input helps to shape an idea.

@jeevatkm

This comment has been minimized.

Copy link
Member

@jeevatkm jeevatkm commented May 1, 2018

@pharrisee Given post is really helpful, he has done quite analysis on this topic. I'm gonna a gather plus points from overall and draw a direction for aah.

Will make good start point for aah single binary goal.

jeevatkm added a commit to go-aah/vfs that referenced this issue May 8, 2018
jeevatkm added a commit to go-aah/vfs that referenced this issue May 9, 2018
jeevatkm added a commit to go-aah/vfs that referenced this issue May 9, 2018
jeevatkm added a commit to go-aah/vfs that referenced this issue May 10, 2018
jeevatkm added a commit to go-aah/vfs that referenced this issue May 11, 2018
jeevatkm added a commit to go-aah/vfs that referenced this issue May 12, 2018
jeevatkm added a commit to go-aah/forge that referenced this issue May 12, 2018
jeevatkm added a commit to go-aah/forge that referenced this issue May 12, 2018
jeevatkm added a commit to go-aah/config that referenced this issue May 12, 2018
jeevatkm added a commit to go-aah/i18n that referenced this issue May 12, 2018
jeevatkm added a commit to go-aah/router that referenced this issue May 12, 2018
jeevatkm added a commit to go-aah/view that referenced this issue May 12, 2018
jeevatkm added a commit that referenced this issue May 12, 2018
jeevatkm added a commit to go-aah/tools that referenced this issue May 16, 2018
…dded
jeevatkm added a commit that referenced this issue May 16, 2018
@jeevatkm

This comment has been minimized.

Copy link
Member

@jeevatkm jeevatkm commented May 16, 2018

Feature implemented, available on edge.

Command is aah build --single or aah b -s

@pharrisee

This comment has been minimized.

Copy link
Author

@pharrisee pharrisee commented May 16, 2018

  1. switched to edge version of AAH and created a new project
  2. edited aah.project to get dependencies
  3. ran project with 'aah r'
  4. get message 'FATAL aah.conf: read \app\config\security.conf: mount does not exist'

Same happens when running 'aah b -s'.

Any ideas?

@jeevatkm

This comment has been minimized.

Copy link
Member

@jeevatkm jeevatkm commented May 16, 2018

@pharrisee Interesting. aah VFS is path separator is always forward slash /. I will verify it with windows OS and get back to you. Thanks.

jeevatkm added a commit to go-aah/forge that referenced this issue May 16, 2018
jeevatkm added a commit to go-aah/tools that referenced this issue May 16, 2018
@jeevatkm

This comment has been minimized.

Copy link
Member

@jeevatkm jeevatkm commented May 16, 2018

@pharrisee I have verified on windows and addressed the path handling on VFS and embed build.

Since you're already on aah edge, run aah s -r to refresh edge version.

Now it should be alright, please let me know if you come across any issues.

Build: aah b -s

@pharrisee

This comment has been minimized.

Copy link
Author

@pharrisee pharrisee commented May 16, 2018

OK, updated to new release with 'aah s -r' had error:

FATAL Unable to refresh dependencies:
# aahframework.org/aah.v0
..\..\aahframework.org\aah.v0\aah.go:278:16: a.VFS().IsEmbeddedMode undefined (type *vfs.VFS has no field or method IsEmbeddedMode)
..\..\aahframework.org\aah.v0\aah.go:282:9: a.VFS().SetEmbeddedMode undefined (type *vfs.VFS has no field or method SetEmbeddedMode)

removed all of the {src,pkg}/aahframework.org directories, and the bin/aah.exe and did another install

ran 'aah s' and get the same error.

@jeevatkm

This comment has been minimized.

Copy link
Member

@jeevatkm jeevatkm commented May 16, 2018

@pharrisee I'm really sorry. I have committed aahframework.org/vfs.v0 but missed to tag the prerelease version before commenting here.

Just did it. Please try again.

@pharrisee

This comment has been minimized.

Copy link
Author

@pharrisee pharrisee commented May 16, 2018

OK, did a complete cleanup and reinstalled, switched to edge and get:

FATAL Unable to refresh library: tools.v0
@jeevatkm

This comment has been minimized.

Copy link
Member

@jeevatkm jeevatkm commented May 16, 2018

Just now docker build got successfully completed the aah edge version.

https://hub.docker.com/r/aahframework/aah/builds/br68v54j4p9cxr9sski7fcu/

aah cli executes git cmd internally; it may be the interim git issue.

I am going to verify the edge version build on fresh VM.

@pharrisee

This comment has been minimized.

Copy link
Author

@pharrisee pharrisee commented May 16, 2018

had to pop to pharmacy, just got back and switched to release, then back to edge seems ok this time. Apologies for that :)

@pharrisee

This comment has been minimized.

Copy link
Author

@pharrisee pharrisee commented May 16, 2018

Quick test shows that it compiled a new Out-of-the-box app fine :)

woohoo!

Good Job.

@jeevatkm

This comment has been minimized.

Copy link
Member

@jeevatkm jeevatkm commented May 16, 2018

No worries, thank you for your patience and time.

@jeevatkm

This comment has been minimized.

Copy link
Member

@jeevatkm jeevatkm commented May 16, 2018

🎉 I am very glad to hear your feedback. Thank you.

@pharrisee

This comment has been minimized.

Copy link
Author

@pharrisee pharrisee commented May 16, 2018

you are very welcome, and thank you for your work on these features, will make it so much easier to get it adopted at my work place.

Just FYI I work in a major UK university (I'm the web architect) and will be doing my damndest to introduce Aah there on a major new project. If I manage it I'll be writing up the experience at a later date. If you're interested in the results I can let you know how it goes.

@jeevatkm

This comment has been minimized.

Copy link
Member

@jeevatkm jeevatkm commented May 16, 2018

Yes, I am interested in it. Please keep me posted when you get a chance.

Also, your pointers for improving aah are very welcome.

jeevatkm added a commit that referenced this issue May 17, 2018
@jeevatkm

This comment has been minimized.

Copy link
Member

@jeevatkm jeevatkm commented May 17, 2018

@pharrisee I thought to share with you. Because documentation gonna take a while.

  • You could mount any directory into aah
  • Accessible via aah.AppVFS() as mounted path regardless of OS and environment
  • Mount directories gets embedded in to binary on aah b -s

Configuration goes in aah.project (you may have noticed in newly generated app from aah new)

#------------------------------------------------------------------------
# Virtual FileSystem (VFS) configuration
#
# Doc: https://docs.aahframework.org/vfs.html
#------------------------------------------------------------------------
vfs {
  # Adding custom mount points.
  #
  # Configured mount points directories and sub-directories
  # are embedded into the aah binary during the single binary build.
  #
  # Note: Embed packaging uses same exclusion list from config `build.excludes`.
  mount {
    # Choose a unique key name
    #my_mount {
    #  # Mount point (path separator is '/').
    #  mount_path = "/my_mount"
    #
    #  # Physical FileSystem path.
    #  # Note: Only absolute path is accepted.
    #  physical_path = "/Users/jeeva/path/to/physical"
    #}
  }

  # This config speeds up the single binary build process.
  # No need to spend time in gzipping; compressed content type.
  #
  # Even without this config, aah decides best on what to gzip.
  no_gzip = [".png", ".jpeg", ".jpg", ".gif", ".bmp", ".tiff", ".tif"
    ".woff", ".woff2"]
}
jeevatkm added a commit that referenced this issue May 18, 2018
jeevatkm added a commit that referenced this issue May 18, 2018
jeevatkm added a commit to go-aah/docs that referenced this issue May 22, 2018
@jeevatkm

This comment has been minimized.

Copy link
Member

@jeevatkm jeevatkm commented May 22, 2018

@jeevatkm jeevatkm closed this May 22, 2018
aah Roadmap automation moved this from v0.11.0 - In Progress to v0.11.0 - Completed May 22, 2018
jeevatkm added a commit to go-aah/app-templates that referenced this issue Jul 4, 2018
@jeevatkm jeevatkm moved this from v0.11.0 - Completed to Released to Audience in aah Roadmap Jul 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
aah Roadmap
  
Released to Audience
3 participants
You can’t perform that action at this time.