magic-pocket-cli 0.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- magic_pocket_cli-0.2.0.dist-info/METADATA +14 -0
- magic_pocket_cli-0.2.0.dist-info/RECORD +65 -0
- magic_pocket_cli-0.2.0.dist-info/WHEEL +4 -0
- magic_pocket_cli-0.2.0.dist-info/entry_points.txt +2 -0
- pocket_cli/__init__.py +0 -0
- pocket_cli/cli/__init__.py +0 -0
- pocket_cli/cli/aws_auth.py +48 -0
- pocket_cli/cli/awscontainer_cli.py +328 -0
- pocket_cli/cli/cloudfront_cli.py +116 -0
- pocket_cli/cli/cloudfront_keys_cli.py +68 -0
- pocket_cli/cli/cloudfront_waf_cli.py +68 -0
- pocket_cli/cli/deploy_cli.py +274 -0
- pocket_cli/cli/destroy_cli.py +358 -0
- pocket_cli/cli/dsql_cli.py +60 -0
- pocket_cli/cli/main_cli.py +91 -0
- pocket_cli/cli/migrate_cli.py +148 -0
- pocket_cli/cli/neon_cli.py +97 -0
- pocket_cli/cli/permissions_cli.py +46 -0
- pocket_cli/cli/rds_cli.py +63 -0
- pocket_cli/cli/runtime_config_cli.py +185 -0
- pocket_cli/cli/s3_cli.py +69 -0
- pocket_cli/cli/status_cli.py +56 -0
- pocket_cli/cli/tidb_cli.py +73 -0
- pocket_cli/cli/vpc_cli.py +92 -0
- pocket_cli/cli/waf_cli.py +182 -0
- pocket_cli/django_cli.py +412 -0
- pocket_cli/mediator.py +220 -0
- pocket_cli/resources/__init__.py +0 -0
- pocket_cli/resources/aws/__init__.py +0 -0
- pocket_cli/resources/aws/builders/__init__.py +57 -0
- pocket_cli/resources/aws/builders/codebuild.py +363 -0
- pocket_cli/resources/aws/builders/depot.py +84 -0
- pocket_cli/resources/aws/builders/docker.py +34 -0
- pocket_cli/resources/aws/builders/dockerignore.py +44 -0
- pocket_cli/resources/aws/cloudformation.py +790 -0
- pocket_cli/resources/aws/ecr.py +145 -0
- pocket_cli/resources/aws/efs.py +138 -0
- pocket_cli/resources/aws/lambdahandler.py +182 -0
- pocket_cli/resources/aws/s3_utils.py +58 -0
- pocket_cli/resources/aws/state.py +74 -0
- pocket_cli/resources/awscontainer.py +265 -0
- pocket_cli/resources/cloudfront.py +491 -0
- pocket_cli/resources/cloudfront_acm.py +55 -0
- pocket_cli/resources/cloudfront_keys.py +81 -0
- pocket_cli/resources/cloudfront_waf.py +67 -0
- pocket_cli/resources/dsql.py +142 -0
- pocket_cli/resources/neon.py +353 -0
- pocket_cli/resources/rds.py +680 -0
- pocket_cli/resources/s3.py +307 -0
- pocket_cli/resources/tidb.py +298 -0
- pocket_cli/resources/upstash.py +152 -0
- pocket_cli/resources/vpc.py +67 -0
- pocket_cli/templates/cloudformation/awscontainer.yaml +516 -0
- pocket_cli/templates/cloudformation/cf_function_api_host.js +5 -0
- pocket_cli/templates/cloudformation/cf_function_spa_auth.js +28 -0
- pocket_cli/templates/cloudformation/cf_function_spa_fallback.js +8 -0
- pocket_cli/templates/cloudformation/cloudfront.yaml +309 -0
- pocket_cli/templates/cloudformation/cloudfront_acm.yaml +43 -0
- pocket_cli/templates/cloudformation/cloudfront_keys.yaml +32 -0
- pocket_cli/templates/cloudformation/cloudfront_waf.yaml +97 -0
- pocket_cli/templates/cloudformation/vpc.yaml +213 -0
- pocket_cli/templates/init/django-dotenv.env +3 -0
- pocket_cli/templates/init/django-settings.py +140 -0
- pocket_cli/templates/init/pocket.Dockerfile +26 -0
- pocket_cli/templates/init/pocket_simple.toml +31 -0
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Django settings for {{ project_name }} project.
|
|
3
|
+
|
|
4
|
+
Generated by 'pocket django init' using magic-pocket.
|
|
5
|
+
|
|
6
|
+
For more information on this file, see
|
|
7
|
+
https://docs.djangoproject.com/en/5.0/topics/settings/
|
|
8
|
+
|
|
9
|
+
For the full list of settings and their values, see
|
|
10
|
+
https://docs.djangoproject.com/en/5.0/ref/settings/
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
from pathlib import Path
|
|
14
|
+
|
|
15
|
+
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
|
16
|
+
BASE_DIR = Path(__file__).resolve().parent.parent
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
# Added by magic-pocket start
|
|
20
|
+
import environ
|
|
21
|
+
|
|
22
|
+
from pocket.django.runtime import set_envs
|
|
23
|
+
from pocket.django.utils import get_caches, get_storages
|
|
24
|
+
|
|
25
|
+
STORAGES = get_storages()
|
|
26
|
+
CACHES = get_caches()
|
|
27
|
+
|
|
28
|
+
environ.Env.read_env(BASE_DIR / ".env")
|
|
29
|
+
env = environ.Env(
|
|
30
|
+
SECRET_KEY=str,
|
|
31
|
+
DEBUG=(bool, False),
|
|
32
|
+
ALLOWED_HOSTS=(list, []),
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
set_envs()
|
|
36
|
+
SECRET_KEY = env.str("SECRET_KEY")
|
|
37
|
+
DEBUG = env.bool("DEBUG")
|
|
38
|
+
DATABASES = {"default": env.db()}
|
|
39
|
+
ALLOWED_HOSTS = env.list("ALLOWED_HOSTS")
|
|
40
|
+
# Added by magic-pocket end
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
# Quick-start development settings - unsuitable for production
|
|
44
|
+
# See https://docs.djangoproject.com/en/5.0/howto/deployment/checklist/
|
|
45
|
+
|
|
46
|
+
# REMOVED by magic-pocket: SECRET_KEY
|
|
47
|
+
|
|
48
|
+
# SECURITY WARNING: don't run with debug turned on in production!
|
|
49
|
+
# REMOVED by magic-pocket: DEBUG
|
|
50
|
+
|
|
51
|
+
# REMOVED by magic-pocket: ALLOWED_HOSTS
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
# Application definition
|
|
55
|
+
|
|
56
|
+
INSTALLED_APPS = [
|
|
57
|
+
"django.contrib.admin",
|
|
58
|
+
"django.contrib.auth",
|
|
59
|
+
"django.contrib.contenttypes",
|
|
60
|
+
"django.contrib.sessions",
|
|
61
|
+
"django.contrib.messages",
|
|
62
|
+
"django.contrib.staticfiles",
|
|
63
|
+
]
|
|
64
|
+
|
|
65
|
+
MIDDLEWARE = [
|
|
66
|
+
"django.middleware.security.SecurityMiddleware",
|
|
67
|
+
"django.contrib.sessions.middleware.SessionMiddleware",
|
|
68
|
+
"django.middleware.common.CommonMiddleware",
|
|
69
|
+
"django.middleware.csrf.CsrfViewMiddleware",
|
|
70
|
+
"django.contrib.auth.middleware.AuthenticationMiddleware",
|
|
71
|
+
"django.contrib.messages.middleware.MessageMiddleware",
|
|
72
|
+
"django.middleware.clickjacking.XFrameOptionsMiddleware",
|
|
73
|
+
]
|
|
74
|
+
|
|
75
|
+
ROOT_URLCONF = "{{ project_name }}.urls"
|
|
76
|
+
|
|
77
|
+
TEMPLATES = [
|
|
78
|
+
{
|
|
79
|
+
"BACKEND": "django.template.backends.django.DjangoTemplates",
|
|
80
|
+
"DIRS": [],
|
|
81
|
+
"APP_DIRS": True,
|
|
82
|
+
"OPTIONS": {
|
|
83
|
+
"context_processors": [
|
|
84
|
+
"django.template.context_processors.debug",
|
|
85
|
+
"django.template.context_processors.request",
|
|
86
|
+
"django.contrib.auth.context_processors.auth",
|
|
87
|
+
"django.contrib.messages.context_processors.messages",
|
|
88
|
+
],
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
]
|
|
92
|
+
|
|
93
|
+
WSGI_APPLICATION = "{{ project_name }}.wsgi.application"
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
# Database
|
|
97
|
+
# https://docs.djangoproject.com/en/5.0/ref/settings/#databases
|
|
98
|
+
|
|
99
|
+
# REMOVED by magic-pocket: DATABASES
|
|
100
|
+
|
|
101
|
+
# Password validation
|
|
102
|
+
# https://docs.djangoproject.com/en/5.0/ref/settings/#auth-password-validators
|
|
103
|
+
|
|
104
|
+
AUTH_PASSWORD_VALIDATORS = [
|
|
105
|
+
{
|
|
106
|
+
"NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator",
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
"NAME": "django.contrib.auth.password_validation.MinimumLengthValidator",
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
"NAME": "django.contrib.auth.password_validation.CommonPasswordValidator",
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
"NAME": "django.contrib.auth.password_validation.NumericPasswordValidator",
|
|
116
|
+
},
|
|
117
|
+
]
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
# Internationalization
|
|
121
|
+
# https://docs.djangoproject.com/en/5.0/topics/i18n/
|
|
122
|
+
|
|
123
|
+
LANGUAGE_CODE = "en-us"
|
|
124
|
+
|
|
125
|
+
TIME_ZONE = "UTC"
|
|
126
|
+
|
|
127
|
+
USE_I18N = True
|
|
128
|
+
|
|
129
|
+
USE_TZ = True
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
# Static files (CSS, JavaScript, Images)
|
|
133
|
+
# https://docs.djangoproject.com/en/5.0/howto/static-files/
|
|
134
|
+
|
|
135
|
+
STATIC_URL = "static/"
|
|
136
|
+
|
|
137
|
+
# Default primary key field type
|
|
138
|
+
# https://docs.djangoproject.com/en/5.0/ref/settings/#default-auto-field
|
|
139
|
+
|
|
140
|
+
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
ARG PYTHON_VERSION=3.12
|
|
2
|
+
FROM public.ecr.aws/docker/library/python:${PYTHON_VERSION}-slim AS base
|
|
3
|
+
|
|
4
|
+
FROM base AS builder
|
|
5
|
+
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv
|
|
6
|
+
ENV PYTHONDONTWRITEBYTECODE=1 \
|
|
7
|
+
PYTHONUNBUFFERED=1 \
|
|
8
|
+
VIRTUAL_ENV=/venv \
|
|
9
|
+
UV_PROJECT_ENVIRONMENT=/venv \
|
|
10
|
+
PATH="/venv/bin:${PATH}"
|
|
11
|
+
WORKDIR /app
|
|
12
|
+
|
|
13
|
+
RUN uv venv $VIRTUAL_ENV
|
|
14
|
+
COPY uv.lock pyproject.toml ./
|
|
15
|
+
RUN uv sync --frozen --no-dev --no-install-project
|
|
16
|
+
|
|
17
|
+
FROM base AS final
|
|
18
|
+
ENV PYTHONDONTWRITEBYTECODE=1 \
|
|
19
|
+
PYTHONUNBUFFERED=1 \
|
|
20
|
+
VIRTUAL_ENV=/venv \
|
|
21
|
+
PATH="/venv/bin:${PATH}"
|
|
22
|
+
WORKDIR /app
|
|
23
|
+
COPY --from=builder /venv /venv
|
|
24
|
+
COPY . .
|
|
25
|
+
|
|
26
|
+
ENTRYPOINT [ "/venv/bin/python", "-m", "awslambdaric" ]
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
[general]
|
|
2
|
+
region = "ap-southeast-1"
|
|
3
|
+
stages = ["dev", "prod"]
|
|
4
|
+
|
|
5
|
+
[s3]
|
|
6
|
+
|
|
7
|
+
[neon]
|
|
8
|
+
project_name = "your-neon-project-name"
|
|
9
|
+
|
|
10
|
+
[awscontainer]
|
|
11
|
+
dockerfile_path = "pocket.Dockerfile"
|
|
12
|
+
|
|
13
|
+
[awscontainer.handlers.wsgi]
|
|
14
|
+
command = "pocket.django.lambda_handlers.wsgi_handler"
|
|
15
|
+
[awscontainer.handlers.management]
|
|
16
|
+
command = "pocket.django.lambda_handlers.management_command_handler"
|
|
17
|
+
timeout = 600
|
|
18
|
+
|
|
19
|
+
[dev.awscontainer.handlers.wsgi]
|
|
20
|
+
apigateway = {}
|
|
21
|
+
[prod.awscontainer.handlers.wsgi]
|
|
22
|
+
apigateway = {}
|
|
23
|
+
|
|
24
|
+
[awscontainer.secrets.managed]
|
|
25
|
+
SECRET_KEY = { type = "password", options = { length = 50 } }
|
|
26
|
+
DJANGO_SUPERUSER_PASSWORD = { type = "password", options = { length = 16 } }
|
|
27
|
+
DATABASE_URL = { type = "neon_database_url" }
|
|
28
|
+
|
|
29
|
+
[awscontainer.django.storages]
|
|
30
|
+
default = { store = "s3", location = "media" }
|
|
31
|
+
staticfiles = { store = "s3", location = "static", static = true, manifest = true }
|