Skip to content
This repository has been archived by the owner on Oct 29, 2020. It is now read-only.

Commit

Permalink
🚀 Kubernetes
Browse files Browse the repository at this point in the history
  • Loading branch information
samzhangjy committed Aug 17, 2020
1 parent 1ded541 commit 6630f44
Show file tree
Hide file tree
Showing 6 changed files with 181 additions and 0 deletions.
101 changes: 101 additions & 0 deletions .stignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
.git
# Byte-compiled / optimized / DLL files
__pycache__
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build
develop-eggs
dist
downloads
eggs
.eggs
lib
lib64
parts
sdist
var
wheels
pip-wheel-metadata
share/python-wheels
*.egg-info
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3

# Flask stuff:
instance
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build

# PyBuilder
target

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default
ipython_config.py

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env
venv
ENV
env.bak
venv.bak

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mypy
.mypy_cache
.dmypy.json
dmypy.json

# Pyre type checker
.pyre
12 changes: 12 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM python:3.8.1

RUN mkdir /api
WORKDIR /api

COPY ./requirements.txt /api/requirements.txt

RUN pip install -r requirements.txt

COPY . /api

CMD uvicorn baiduspider.api.app:app --host=0.0.0.0
34 changes: 34 additions & 0 deletions deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: baiduspider-deploy
labels:
app: baiduspider-app
spec:
selector:
matchLabels:
app: baiduspider-app
replicas: 2
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 1
maxUnavailable: 0
template:
metadata:
labels:
app: baiduspider-app
spec:
containers:
- name: baiduspider-app
image: samzhangjy/baiduspider:1.0.0
imagePullPolicy: Always
ports:
- containerPort: 8000
resources:
requests:
memory: "64Mi"
cpu: "50m"
limits:
memory: "256Mi"
cpu: "500m"
9 changes: 9 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: "3.4"
services:
python:
build:
context: .
container_name: api
image: samzhangjy/baiduspider:1.0.0
ports:
- 8000:8000
13 changes: 13 additions & 0 deletions okteto.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: baiduspider
image: okteto/python:3
command:
- bash
workdir: /okteto
forward:
- 8080:8080
reverse:
- 9000:9000
volumes:
- /root/.cache/pip
persistentVolume:
enabled: true
12 changes: 12 additions & 0 deletions service.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: v1
kind: Service
metadata:
name: baiduspider-service
spec:
type: LoadBalancer
selector:
app: baiduspider-app
ports:
- protocol: TCP
port: 80
targetPort: 8000

1 comment on commit 6630f44

@vercel
Copy link

@vercel vercel bot commented on 6630f44 Aug 17, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.