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

Documentation on using gunicorn and uv run #146

Open
simonw opened this issue Oct 9, 2024 · 4 comments
Open

Documentation on using gunicorn and uv run #146

simonw opened this issue Oct 9, 2024 · 4 comments
Labels
deployment Anything related to deployment

Comments

@simonw
Copy link

simonw commented Oct 9, 2024

The https://otterwiki.com/Installation instructions currently lean towards "production" installations - Docker, Kubernetes, uwsgi.

I wanted to try it out on my laptop with the least possible steps - it turns out this worked for me:

git clone https://github.com/redimp/otterwiki.git
cd otterwiki

mkdir -p app-data/repository
git init app-data/repository

echo "REPOSITORY='${PWD}/app-data/repository'" >> settings.cfg
echo "SQLALCHEMY_DATABASE_URI='sqlite:///${PWD}/app-data/db.sqlite'" >> settings.cfg
echo "SECRET_KEY='$(echo $RANDOM | md5sum | head -c 16)'" >> settings.cfg

export OTTERWIKI_SETTINGS=$PWD/settings.cfg
uv run --with gunicorn gunicorn --bind 127.0.0.1:8080 otterwiki.server:app

This uv run command automatically creates a virtual environment, installs the pyproject.toml dependencies, installs gunicorn as well (--with gunicorn) and starts that running the server.

@simonw
Copy link
Author

simonw commented Oct 9, 2024

It would be cool if the otterwiki PyPI package could be run something like this:

pip install otterwiki
otterwiki \
  --repository app-data/repository \
  --db sqlite:///${PWD}/app-data/db.sqlite \
  --secret-key secret1 \
  --port 8080

That would make it even easier for people to try it out.

@e12e
Copy link

e12e commented Oct 9, 2024

Nice. I assume your first snippet assumes pip install uv or equivalent?

@simonw
Copy link
Author

simonw commented Oct 9, 2024

Yes, install uv using your method of choice: https://docs.astral.sh/uv/getting-started/installation/

@redimp
Copy link
Owner

redimp commented Oct 9, 2024

Hey @simonw, I like to idea of running An Otter Wiki via a shell command. At least for testing in a non-production environment this would be very useful! With using not just flask but running a wsgi server (for example uv as you suggested) even in production environments.

I'll take a look at how this can be implemented.

@redimp redimp added the deployment Anything related to deployment label Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deployment Anything related to deployment
Projects
None yet
Development

No branches or pull requests

3 participants