Skip to content

Commit

Permalink
Add deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
swo committed Mar 1, 2025
1 parent d5a893a commit 4df2c1f
Show file tree
Hide file tree
Showing 5 changed files with 121 additions and 9 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -369,3 +369,7 @@ deps/src/
# such, it should not be committed for packages, but should be committed for
# applications that require a static environment.
#Manifest.toml

# Posit Connect files
manifest.json
requirements.txt
23 changes: 23 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
MANIFEST_FILES = manifest.json requirements.txt
SOURCE_FILES := src/reedfrost/__init__.py src/reedfrost/app.py

.PHONY: local deploy clean

local:
poetry run streamlit run src/reedfrost/app.py

deploy: $(MANIFEST_FILES) $(SOURCE_FILES)
rsconnect deploy \
manifest manifest.json \
--title reedfrost

manifest.json requirements.txt: $(SOURCE_FILES)
rm -f requirements.txt
rsconnect write-manifest streamlit . \
$(SOURCE_FILES) \
--exclude "**" \
--entrypoint src/reedfrost/app.py \
--overwrite

clean:
rm -f $(MANIFEST_FILES)
29 changes: 25 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,37 @@ This is a [poetry](https://python-poetry.org/)-enabled Python project:
2. [Install poetry](https://python-poetry.org/docs/#installation).
3. Install this package locally with `poetry install`.

### App

Run the [Streamlit](https://streamlit.io/) app locally: `poetry run streamlit run src/reedfrost/app.py`.

### Docs

Read the [docs online](https://cdcgov.github.io/reedfrost/).

Documentation is built using [`mkdocs`](https://www.mkdocs.org/). View the documentation locally with `poetry run mkdocs serve`.

### Local app

Run the [Streamlit](https://streamlit.io/) app locally with `make local`.

### Deployed app

To deploy using [Posit Connect](https://docs.posit.co/connect/user/publishing-cli/):

- Navigate to your Posit server
- Request to be made a Publisher
- Get an API key
- Add the server:
```
rsconnect add \
--server YOUR_SERVER \
--name NICKNAME \
--api-key YOUR_API_KEY
```
You may need to add `--insecure` if you have certificate problems.
- Check which versions of Python are installed on the server:
```
rsconnect details -n NICKNAME
```
Ensure that the app is developed against a compatible version of Python.

## Project admins

- Scott Olesen <[email protected]> (CDC/IOD/ORR/CFA)
Expand Down
73 changes: 68 additions & 5 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ polars = "^1.23.0"

[tool.poetry.group.dev.dependencies]
pytest = "^8.3.4"
rsconnect-python = "^1.25.2"


[tool.poetry.group.mkdocs.dependencies]
Expand Down

0 comments on commit 4df2c1f

Please sign in to comment.