Skip to content

Compile web assets into the binary #1093

Closed

Description

@wmrowan

Having a bunch of files separate from the main binary is a real drag. I have to remember to copy a whole folder whenever I move the rethinkdb binary or run it from a different location or I have to figure out where the folder is installed and pass it as an option to rethinkdb on startup.

We should compile the web assets into the rethinkdb binary and have the web server point serve from there. This would be much more convenient than having a separate directory.

Activity

  1. neumino commented on Jun 29, 2013

    @neumino
    Member

    Hum currently my workflow is the following one

    • Build
    • Start the server
    • Update the web interface code
    • Refresh the browser
    • Repeat update/refresh

    If the web assets are in the binary, I would have to kill and restart the server every time , and that would be kind of painful.

  2. AtnNn commented on Jul 1, 2013

    @AtnNn
    Member

    The old behaviour can be kept if dirname $0/rethinkdb_web_assets exists.

  3. wmrowan commented on Jul 1, 2013

    @wmrowan
    ContributorAuthor

    This could also be a dev vs. release difference. If the fallback is in
    place this could be done by simply not distributing the
    rethinkdb_web_assets folder with the package.

    On Mon, Jul 1, 2013 at 12:42 PM, Etienne Laurin [email protected]:

    The old behaviour can be kept if dirname $0/rethinkdb_web_assets exists.

    —
    Reply to this email directly or view it on GitHubhttps://github.com//issues/1093#issuecomment-20305260
    .

  4. AtnNn commented on Jul 1, 2013

    @AtnNn
    Member

    We should avoid using build options for features that can easily be runtime options.

  5. wmrowan commented on Jul 1, 2013

    @wmrowan
    ContributorAuthor

    sorry, I should have been clear. I meant to say that we could build the web
    assets into the binary and build the web assets directory, defaulting to
    the directory if its available and falling back to the inbuilt versions at
    runtime. When developing the directory would be available and that would be
    used. The main change we would make would be to exclude the web assets
    directory from the package so that the released version installed by most
    users would end up using the built in versions of the web assets.

    On Mon, Jul 1, 2013 at 2:00 PM, Etienne Laurin [email protected]:

    We should avoid using build options for features that can easily be
    runtime options.

    —
    Reply to this email directly or view it on GitHubhttps://github.com//issues/1093#issuecomment-20309993
    .

  6. AtnNn commented on Apr 1, 2014

    @AtnNn
    Member

    After upgrading from 1.11 to 1.12, users may encounter this error:

    RqlClientError: MALFORMED PROTOBUF (missing field `type`)
    

    This happens when the running 1.11 server starts serving the web assets for the 1.12 server. The solution is to stop the 1.11 instance and then start the 1.12 instance (after migrating the data).

    Putting the web assets into the binary would also solve this issue. The gzipped web assets weigh under 2 MiB.

  7. neumino commented on Apr 1, 2014

    @neumino
    Member

    I would be ok with that as long as we keep the web-static-directory or the current behavior for DEBUG build.

  8. neumino commented on Apr 10, 2014

    @neumino
    Member

    One good reason to do this would be to make sure that the version reported on the web interface is actually the version of the server.

    What could happen is

    ` The user starts 1.11

    • The user update to 1.12
    • The user doesn't restart the server, but the web assets have been changed, so the version reported in the web interface is 1.12 while the server is actually running 1.11.
  9. mglukhovsky commented on Apr 10, 2014

    @mglukhovsky
    Member

    @neumino: that's a very strong argument for packaging the web assets into the binary. I think that keeping --web-static-directory is a reasonable workaround for the development workflow.

  10. self-assigned this
    on Sep 24, 2014
  11. modified the milestones: 1.16, backlog on Sep 24, 2014
  12. AtnNn commented on Sep 24, 2014

    @AtnNn
    Member

    This issue has come up again.

    The easiest, most flexible and most portable way I can find to implement this is to write a small script that generates a C file that contains each file from the web assets as a separate string literal along with metadata such as file names and sizes.

  13. timmaxw commented on Sep 24, 2014

    @timmaxw
    Member

    The xxd tool may be useful:

    $ echo "Hello, World!" > hello
    $ xxd -i hello
    unsigned char hello[] = {
      0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x2c, 0x20, 0x57, 0x6f, 0x72, 0x6c, 0x64,
      0x21, 0x0a
    };
    unsigned int hello_len = 14;
    

    But it seems like an incomplete solution. At the very least we would also need to construct a file lookup table.

  14. AtnNn commented on Sep 30, 2014

    @AtnNn
    Member

    I have had some success with a custom python script that generates both compact string literals for the data along with a lookup table for file names.

  15. AtnNn commented on Oct 17, 2014

    @AtnNn
    Member
    • It is no longer possible to build rethinkdb without building the web assets.
    • The --web-static-directory flag is now the only way to use custom web assets at runtime. The ./rethinkdb_web_assets folder no longer has any special meaning.
    • The rethinkdb executable is now about 5 MiB larger.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions