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

Implement command-line tool interface #40

Closed
simonw opened this issue Oct 25, 2017 · 11 comments
Closed

Implement command-line tool interface #40

simonw opened this issue Oct 25, 2017 · 11 comments

Comments

@simonw
Copy link
Owner

simonw commented Oct 25, 2017

The first version needs to take one or more file names or URLs, then generate and deploy an app to Now. It will assume you already have the now command installed and configured.

@simonw simonw added the medium label Oct 25, 2017
@simonw simonw added this to the Ship v1 milestone Oct 25, 2017
@simonw
Copy link
Owner Author

simonw commented Oct 25, 2017

Simplest implementation will be to create a temporary directory somewhere, copy in a Dockerfile and the databases and run “now” in it.

Ideally I can use symlinks rather than copying potentially large database files around.

@simonw simonw changed the title Implement command-line tool for deploying a database(s) Implement command-line tool interface Oct 26, 2017
@simonw
Copy link
Owner Author

simonw commented Oct 26, 2017

I’m going to have a single command-line app that does everything.

Name to be decided - options include dataset, stateless, datasite (I quite like that - it reflects SQLite and the fact that you create a website)

@simonw
Copy link
Owner Author

simonw commented Oct 26, 2017

datasite .

  • starts web app in current directory, serving all DB files

datasite . -p 8001

  • serves on custom port

datasite blah.db blah2.db

  • serves specified files

You can’t specify more than one directory. You can specify as many files as you like. If you specify two files with different oaths but the same name then they must be accessed by hash.

datasite publish .

  • publishes current directory to the internet! Uses now by default, if it detects it on your path. Other publishers will be eventually added as plugins.

datasite publish http://path-to-db.db

  • publishes a DB available at a URL. Works by constructing the Dockerfile with wget calls in it.

datasite blah.db -m metadata.json

If you specify a directory it looks for metadata.json in that directory. Otherwise you can pass an explicit metadata file oath with -m or —metadata

@simonw
Copy link
Owner Author

simonw commented Oct 26, 2017

Another potential name: datapi

@simonw simonw added large and removed medium labels Oct 26, 2017
@simonw
Copy link
Owner Author

simonw commented Oct 26, 2017

@simonw
Copy link
Owner Author

simonw commented Oct 26, 2017

Here’s how to make the “serve” subcommand the default if it is called with no arguments:

@click.group(invoke_without_command=True)
def serve():
    # ...

simonw added a commit that referenced this issue Oct 27, 2017
I'm using click, and click recommends using a setup.py - so I've added one of
those. I also refactored code into a new datasite package. It's not quite
deploying to now properly at the moment though - I seem to have messed up the
path handling a bit.

Also snuck in a new template for the "Row" view.

Refs #40
@simonw
Copy link
Owner Author

simonw commented Oct 27, 2017

Deploys to Now aren't working at the moment - they aren't showing the uploaded databases, because I've broken the path handling somehow. I need to do a bit more work here.

@simonw
Copy link
Owner Author

simonw commented Oct 30, 2017

http://the-hitchhikers-guide-to-packaging.readthedocs.io/en/latest/quickstart.html describes how to package this for PyPI

@simonw
Copy link
Owner Author

simonw commented Nov 5, 2017

To simplify things a bit, I'm going to require that every database is explicitly listed in the command line. I won't support "serve everything in this directory" for the moment.

simonw added a commit that referenced this issue Nov 6, 2017
@simonw
Copy link
Owner Author

simonw commented Nov 6, 2017

... I tried that, I don't like it. I'm going to bring back "directory serving" by allowing you to pass a directory as an argument to datasite (including datasite .). I may even make . the default if you don't provide anything at all.

@simonw
Copy link
Owner Author

simonw commented Nov 11, 2017

I'm happy with this now that I've implemented the publish command in #26

@simonw simonw closed this as completed Nov 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant