Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Marc Skov Madsen authored and Marc Skov Madsen committed Oct 6, 2019
1 parent 7f2e54f commit a361a6b
Show file tree
Hide file tree
Showing 8 changed files with 163 additions and 8 deletions.
129 changes: 129 additions & 0 deletions .streamlit/config.local.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
# Below are all the sections and options you can have in ~/.streamlit/config.toml.

[global]

# By default, Streamlit checks if the Python watchdog module is available and, if not, prints a warning asking for you to install it. The watchdog module is not required, but highly recommended. It improves Streamlit's ability to detect changes to files in your filesystem.
# If you'd like to turn off this warning, set this to True.
# Default: false
disableWatchdogWarning = false

# Configure the ability to share apps to the cloud.
# Should be set to one of these values: - "off" : turn off sharing. - "s3" : share to S3, based on the settings under the [s3] section of this config file.
# Default: "off"
sharingMode = "off"

# If True, will show a warning when you run a Streamlit-enabled script via "python my_script.py".
# Default: true
showWarningOnDirectExecution = true

# Level of logging: 'error', 'warning', 'info', or 'debug'.
# Default: 'info'
logLevel = "info"


[client]

# Whether to enable st.cache.
# Default: true
caching = true

# If false, makes your Streamlit script not draw to a Streamlit app.
# Default: true
displayEnabled = true


[runner]

# Allows you to type a variable or string by itself in a single line of Python code to write it to the app.
# Default: true
magicEnabled = true

# Install a Python tracer to allow you to stop or pause your script at any point and introspect it. As a side-effect, this slows down your script's execution.
# Default: false
installTracer = false

# Sets the MPLBACKEND environment variable to Agg inside Streamlit to prevent Python crashing.
# Default: true
fixMatplotlib = true


[server]

# List of folders that should not be watched for changes. Relative paths will be taken as relative to the current working directory.
# Example: ['/home/user1/env', 'relative/path/to/folder']
# Default: []
folderWatchBlacklist = []

# If false, will attempt to open a browser window on start.
# Default: false unless (1) we are on a Linux box where DISPLAY is unset, or (2) server.liveSave is set.
headless = true

# Immediately share the app in such a way that enables live monitoring, and post-run analysis.
# Default: false
liveSave = false

# Automatically rerun script when the file is modified on disk.
# Default: false
runOnSave = false

# The port where the server will listen for client and browser connections.
# Default: 8000
port = 8000

# Enables support for Cross-Origin Request Sharing, for added security.
# Default: true
enableCORS = true


[browser]

# Internet address of the server server that the browser should connect to. Can be IP address or DNS name.
# Default: 'localhost'
serverAddress = "127.0.0.1"

# Whether to send usage statistics to Streamlit.
# Default: true
gatherUsageStats = true

# Port that the browser should use to connect to the server when in liveSave mode.
# Default: whatever value is set in server.port.
serverPort = 8000


[s3]

# Name of the AWS S3 bucket to save apps.
# Default: (unset)
#bucket =

# URL root for external view of Streamlit apps.
# Default: (unset)
#url =

# Access key to write to the S3 bucket.
# Leave unset if you want to use an AWS profile.
# Default: (unset)
#accessKeyId =

# Secret access key to write to the S3 bucket.
# Leave unset if you want to use an AWS profile.
# Default: (unset)
#secretAccessKey =

# Make the shared app visible only to users who have been granted view permission. If you are interested in this option, contact us at support@streamlit.io.
# Default: false
requireLoginToView = false

# The "subdirectory" within the S3 bucket where to save apps.
# S3 calls paths "keys" which is why the keyPrefix is like a subdirectory. Use "" to mean the root directory.
# Default: ""
keyPrefix = ""

# AWS region where the bucket is located, e.g. "us-west-2".
# Default: (unset)
#region =

# AWS credentials profile to use.
# Leave unset to use your default profile.
# Default: (unset)
#profile =
6 changes: 3 additions & 3 deletions .streamlit/config.prod.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ liveSave = false
runOnSave = false

# The port where the server will listen for client and browser connections.
# Default: 8501
port = 8501
# Default: 8000
port = 8000

# Enables support for Cross-Origin Request Sharing, for added security.
# Default: true
Expand All @@ -87,7 +87,7 @@ gatherUsageStats = true

# Port that the browser should use to connect to the server when in liveSave mode.
# Default: whatever value is set in server.port.
serverPort = 8501
serverPort = 8000


[s3]
Expand Down
3 changes: 3 additions & 0 deletions .streamlit/credentials.local.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[general]

email=""
2 changes: 1 addition & 1 deletion devops/docker/Dockerfile.prod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM marcskovmadsen/awesome-streamlit/awesome-streamlit_base:latest

EXPOSE 8501
EXPOSE 8000

WORKDIR /app
ADD . ./
Expand Down
6 changes: 4 additions & 2 deletions tasks/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
"""Here we import the different task submodules/ collections"""
from invoke import Collection
from invoke import Collection, task

from tasks import docker, test
from tasks import docker, test, local

# pylint: disable=invalid-name
# as invoke only recognizes lower case
namespace = Collection()
namespace.add_collection(test)
namespace.add_collection(docker)
namespace.add_collection(local)

4 changes: 2 additions & 2 deletions tasks/docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def run(c, image="awesome-streamlit", tag="latest"): # pylint: disable=unused-a
"""
)
command = (
f'docker run -it -p 8501:8501 --entrypoint "/bin/bash" '
f'docker run -it -p 8000:8000 --entrypoint "/bin/bash" '
f"{DOCKER_REGISTRY}/{image}:{tag} "
)
print(command)
Expand Down Expand Up @@ -178,7 +178,7 @@ def run_server(c): # pylint: disable=unused-argument
"""
)
command = (
'docker run -it -p 8501:8501 --entrypoint "streamlit" '
'docker run -it -p 8000:8000 --entrypoint "streamlit" '
f"{DOCKER_REGISTRY}/{image}:{tag} "
"run src/app.py"
)
Expand Down
13 changes: 13 additions & 0 deletions tasks/local.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from invoke import task


@task
def deploy(c):
c.run("git push azure-web-app master")


@task
def run_server(c):
c.run(
"streamlit run src/app.py"
)
8 changes: 8 additions & 0 deletions tasks/production.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from invoke import task


@task
def run_server(c):
c.run(
"cp .streamlit/config.prod.toml ~/.streamlit/config.toml & cp .streamlit/credentials.prod.toml ~/.streamlit/credentials.toml & streamlit run src/app.py"
)

0 comments on commit a361a6b

Please sign in to comment.