You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unfortunately, the SAM CLI project has a few needed enhancements and if you decide to do any local development via the sam local start-api command, it will need to be patched on your local machine. I used the commands below to find the two files needing patching.
$ which sam # Use directory info below in find command.
$ find /usr/local -name container.py | grep samcli
$ find /usr/local -name local_apigw_service.py | grep samcli
Here are the issues we have created on the SAM CLI project. Details on the patches below.
If you are on a Mac, Docker has a known performance issue when sharing volumes due to the overhead of keeping files in sync. This performance issue means your Rails application could take ~60 seconds to load in development. Thankfully, Docker has tooling in place to help.
Once you found the correct container.py file, make this change below to tell the Docker SDK to mount the volume with both the ro (read-only) option and delegated consistency mode.
@@ -95,7 +95,7 @@
# https://docs.docker.com/storage/bind-mounts
# Mount the host directory as "read only" inside container
"bind": self._working_dir,
- "mode": "ro"+ "mode": "ro,delegated"
}
},
# We are not running an interactive shell here.
Fixing Root SAM Local Proxy Paths
We need our API Gateway to use both a root path and a greedy proxy path to forward to Rails in development. SAM has a feature compatibility bug where it forces static file hosting on the root path. Once you found the correct local_apigw_service.py file, make the change below to disable static public directory assets on the root path. Don't worry, Rails & Rack will serve your static files automatically instead.
@@ -71,7 +71,7 @@
"""
self._app = Flask(__name__,
- static_url_path="", # Mount static files at root '/'+ static_url_path=None, # Mount static files at root '/'
static_folder=self.static_dir # Serve static files from this directory
)
The text was updated successfully, but these errors were encountered:
Unfortunately, the SAM CLI project has a few needed enhancements and if you decide to do any local development via the sam local start-api command, it will need to be patched on your local machine. I used the commands below to find the two files needing patching.
Here are the issues we have created on the SAM CLI project. Details on the patches below.
Docker Volume Mount Performance on Mac
If you are on a Mac, Docker has a known performance issue when sharing volumes due to the overhead of keeping files in sync. This performance issue means your Rails application could take ~60 seconds to load in development. Thankfully, Docker has tooling in place to help.
Once you found the correct
container.py
file, make this change below to tell the Docker SDK to mount the volume with both thero
(read-only) option anddelegated
consistency mode.Fixing Root SAM Local Proxy Paths
We need our API Gateway to use both a root path and a greedy proxy path to forward to Rails in development. SAM has a feature compatibility bug where it forces static file hosting on the root path. Once you found the correct
local_apigw_service.py
file, make the change below to disable staticpublic
directory assets on the root path. Don't worry, Rails & Rack will serve your static files automatically instead.The text was updated successfully, but these errors were encountered: