Skip to content

Commit

Permalink
Rename to ZappaDock
Browse files Browse the repository at this point in the history
  • Loading branch information
dickermoshe committed Feb 20, 2022
1 parent 27114e4 commit da83e7c
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 14 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -152,4 +152,5 @@ cython_debug/
#.idea/
.python-version
.zappaenv-Dockerfile
.zappadock-Dockerfile
zappa-venv/
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# ZappaEnv
# ZappaDock
## About
This package makes dealing with Zappa a walk in the park.
### How ?
Expand All @@ -8,21 +8,21 @@ We LOVE Zappa. However it's not the MOST user-friendly application ever.
You see, Zappa builds all your requirements before uploading your app to AWS Lambda. The problem is that your OS looks nothing like the environment that AWS Lambda looks like.
### So What's the problem ?
Simply, pip downloads the packages that are compatible with the computer it is running on, so when Zappa uploads it to AWS Lambda, many packages don't work (notably `psycopg2` among others).
### What Does ZappaEnv Do ?
ZappaEnv runs a docker container that mimics the AWS Lambda environment.
### What Does ZappaDock Do ?
ZappaDock runs a docker container that mimics the AWS Lambda environment.
All your code is mounted and inside of a virtual environment.
Your AWS credentials are also automatically loaded from your environmental variables or your aws credential file.
So now yor code is running in a Python virtual environment inside of a docker container.
From here you can test your app and run the Zappa commands you need.
## Install
It's dead simple :
```
$ pip install zappaenv
$ pip install zappadock
```
## Uninstall
Duh. Just :
```
$ pip uninstall zappaenv
$ pip uninstall zappadock
```
## Contributing
I mostly made this for myself. Just threw it together. If you want to make this a masterpiece, be a sport and contribute.
Expand Down
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
long_description = fh.read()

setup(
name="zappaenv",
name="zappadock",
version='0.1.0',
author="Moshe Dicker",
author_email='[email protected]',
description="A tool for running Zappa commands in a Lambda-like' environment.",
url='https://github.com/dickermoshe/zappaenv',
url='https://github.com/dickermoshe/zappadock',
license='GNU General Public License v3.0',
long_description=long_description,
long_description_content_type="text/markdown",
Expand All @@ -20,7 +20,7 @@
packages=find_packages(),
entry_points={
'console_scripts': [
'zappaenv = zappaenv:zappaenv',
'zappadock = zappadock:zappadock',
],
},
python_requires=">=3.6,!=3.10.*,!=3.11.*",
Expand Down
12 changes: 6 additions & 6 deletions zappaenv.py → zappadock.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
WORKDIR /var/task
# Fancy prompt to remind you are in ZappaEnv
RUN echo 'export PS1="\[\e[36m\]ZappaEnv>\[\e[m\] "' >> /root/.bashrc
# Fancy prompt to remind you are in ZappaDock
RUN echo 'export PS1="\[\e[36m\]ZappaDock>\[\e[m\] "' >> /root/.bashrc
# Additional RUN commands here
RUN yum clean all
Expand Down Expand Up @@ -55,8 +55,8 @@ def get_creds_from_credentials_file():
return key, secret, region if not None in (key, secret, region) else False

@click.command()
def zappaenv():
docker_file = '.zappaenv-Dockerfile'
def zappadock():
docker_file = '.zappadock-Dockerfile'
if not os.path.isfile(docker_file):
click.echo(f"Creating Dockerfile.")
with open(docker_file, 'w') as f:
Expand Down Expand Up @@ -107,13 +107,13 @@ def zappaenv():
click.echo("Exiting...")
exit()

# Create command to start ZappaEnv
# Create command to start ZappaDock
cmnd1 ="docker run -ti --rm"
cmnd2 = f"-e AWS_ACCESS_KEY_ID={credentials[0]} -e AWS_SECRET_ACCESS_KEY={credentials[1]} -e AWS_DEFAULT_REGION={credentials[2]}"
cmnd3 = f'-v "{os.getcwd()}:/var/task" {docker_image[0].id}'

# Run command
click.echo("Starting ZappaEnv...")
click.echo("Starting ZappaDock...")
os.system(f"{cmnd1} {cmnd2} {cmnd3}")


Expand Down

0 comments on commit da83e7c

Please sign in to comment.