GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Merge pull request #62 from wangxf123456/django-guestbook-template-all · msedebay-git/cloud-code-samples@19fac0d

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • python/django/python-guestbook
    • .idea
      • externalDependencies.xml
    • .vscode
      • extensions.json
      • launch.json
      • tasks.json
    • kubernetes-manifests
      • guestbook-app.deployment.yaml
      • guestbook-app.migration.yaml
      • guestbook-app.service.yaml
      • guestbook-postgres.deployment.yaml
      • guestbook-postgres.service.yaml
    • skaffold.yaml
    • src
      • Dockerfile
      • guestbook
        • __init__.py
        • settings.py
        • urls.py
        • wsgi.py
      • manage.py
      • message
        • __init__.py
        • admin.py
        • apps.py
        • migrations
          • 0001_initial.py
          • __init__.py
        • models.py
        • templates
          • home.html
        • tests.py
        • views.py
      • requirements.txt
      • staticfiles
        • favicon.png
        • style.css
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎python/django/python-guestbook/.idea/externalDependencies.xml‎

Copy file name to clipboardExpand all lines: python/django/python-guestbook/.idea/externalDependencies.xml
+6Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Collapse file

‎python/django/python-guestbook/.vscode/extensions.json‎

Copy file name to clipboard
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"recommendations": [
3+
"googlecloudtools.cloudcode",
4+
]
5+
}
Collapse file

‎python/django/python-guestbook/.vscode/launch.json‎

Copy file name to clipboard
+21Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// launch.json contains information needed for the debugger to attach to processes
2+
// See https://code.visualstudio.com/Docs/editor/debugging#_launch-configurations
3+
// for documentation about how to create and manage configurations
4+
{
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"podSelector": {
9+
"app": "python-guestbook",
10+
"tier": "app"
11+
},
12+
"type": "cloudcode",
13+
"request": "attach",
14+
"localRoot": "${workspaceFolder}/src",
15+
"language": "Python",
16+
"remoteRoot": "/app",
17+
"name": "Debug on Kubernetes",
18+
"debugPort": 8080
19+
}
20+
]
21+
}
Collapse file

‎python/django/python-guestbook/.vscode/tasks.json‎

Copy file name to clipboard
+15Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// tasks.josn defines quick commands that cam be launched in Visual Studio Code
2+
// See https://go.microsoft.com/fwlink/?LinkId=733558
3+
// for the documentation about the tasks.json format
4+
{
5+
"version": "2.0.0",
6+
"tasks": [
7+
{
8+
"label": "Pylint",
9+
"type": "shell",
10+
"command": "python3",
11+
"args": ["-m", "pylint", "src/**/*.py"],
12+
"problemMatcher": []
13+
}
14+
]
15+
}
Collapse file

‎python/django/python-guestbook/kubernetes-manifests/guestbook-app.deployment.yaml‎

Copy file name to clipboard
+41Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
apiVersion: extensions/v1beta1
2+
kind: Deployment
3+
metadata:
4+
name: python-guestbook-app
5+
labels:
6+
app: python-guestbook
7+
tier: app
8+
spec:
9+
replicas: 1
10+
selector:
11+
matchLabels:
12+
app: python-guestbook
13+
tier: app
14+
template:
15+
metadata:
16+
labels:
17+
app: python-guestbook
18+
tier: app
19+
spec:
20+
initContainers:
21+
# Wait for the database to get ready before starting the server, otherwise
22+
# the server will crash
23+
- name: check-db-ready
24+
image: postgres
25+
command: ['sh', '-c',
26+
'until pg_isready -h python-guestbook-db.default.svc.cluster.local -p 5432;
27+
do echo waiting for database; sleep 2; done;']
28+
containers:
29+
- name: python-guestbook
30+
image: python-guestbook
31+
ports:
32+
- containerPort: 8080
33+
env:
34+
- name: DATABASE_NAME
35+
value: "postgres"
36+
- name: DATABASE_USER
37+
value: "postgres"
38+
- name: DATABASE_HOST
39+
value: "python-guestbook-db"
40+
- name: DATABASE_PORT
41+
value: "5432"
Collapse file

‎python/django/python-guestbook/kubernetes-manifests/guestbook-app.migration.yaml‎

Copy file name to clipboard
+34Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# This file creates a job that migrates the Postgres database. The job creates a
2+
# pod from the specified Docker image, wait for the database to get ready, and
3+
# run database migration once the Postgres database service is ready to receive
4+
# connections.
5+
apiVersion: batch/v1
6+
kind: Job
7+
metadata:
8+
name: python-guestbook-migration
9+
spec:
10+
template:
11+
metadata:
12+
name: python-guestbook-migration
13+
spec:
14+
initContainers:
15+
# Wait for the database to get ready before doing migration
16+
- name: check-db-ready
17+
image: postgres
18+
command: ['sh', '-c',
19+
'until pg_isready -h python-guestbook-db.default.svc.cluster.local -p 5432;
20+
do echo waiting for database; sleep 2; done;']
21+
containers:
22+
- name: python-guestbook-migration
23+
image: python-guestbook
24+
command: [ "/bin/sh", "-c", "python manage.py migrate" ]
25+
env:
26+
- name: DATABASE_NAME
27+
value: "postgres"
28+
- name: DATABASE_USER
29+
value: "postgres"
30+
- name: DATABASE_HOST
31+
value: "python-guestbook-db"
32+
- name: DATABASE_PORT
33+
value: "5432"
34+
restartPolicy: OnFailure
Collapse file

‎python/django/python-guestbook/kubernetes-manifests/guestbook-app.service.yaml‎

Copy file name to clipboard
+15Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: python-guestbook-app
5+
labels:
6+
app: python-guestbook
7+
tier: app
8+
spec:
9+
type: LoadBalancer
10+
ports:
11+
- port: 80
12+
targetPort: 8080
13+
selector:
14+
app: python-guestbook
15+
tier: app
Collapse file

‎python/django/python-guestbook/kubernetes-manifests/guestbook-postgres.deployment.yaml‎

Copy file name to clipboard
+30Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
################################################################################
2+
# WARNING: These settings are used for educational purposes only. This Postgres
3+
# database deployment is not suitable for production as the data is not
4+
# persistently stored and will go away every time the Pod restarts. Consider
5+
# using a Helm chart that provisions a StatefulSet instead of Deployment.
6+
################################################################################
7+
apiVersion: apps/v1
8+
kind: Deployment
9+
metadata:
10+
name: python-guestbook-db
11+
labels:
12+
app: python-guestbook
13+
tier: db
14+
spec:
15+
replicas: 1
16+
selector:
17+
matchLabels:
18+
app: python-guestbook
19+
tier: db
20+
template:
21+
metadata:
22+
labels:
23+
app: python-guestbook
24+
tier: db
25+
spec:
26+
containers:
27+
- image: postgres:9.6
28+
name: db
29+
ports:
30+
- containerPort: 5432
Collapse file

‎python/django/python-guestbook/kubernetes-manifests/guestbook-postgres.service.yaml‎

Copy file name to clipboard
+15Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: python-guestbook-db
5+
labels:
6+
app: python-guestbook
7+
tier: db
8+
spec:
9+
type: ClusterIP
10+
ports:
11+
- port: 5432
12+
targetPort: 5432
13+
selector:
14+
app: python-guestbook
15+
tier: db
Collapse file

‎python/django/python-guestbook/skaffold.yaml‎

Copy file name to clipboard
+19Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
apiVersion: skaffold/v1beta11
2+
kind: Config
3+
build:
4+
tagPolicy:
5+
sha256: {}
6+
# defines where to find the code at build time and where to push the resulting image
7+
artifacts:
8+
- context: src
9+
image: python-guestbook
10+
# defines the Kubernetes manifests to deploy on each run
11+
deploy:
12+
kubectl:
13+
manifests:
14+
- kubernetes-manifests/**.yaml
15+
profiles:
16+
# use the cloudbuild profile to build images using Google Cloud Build
17+
- name: cloudbuild
18+
build:
19+
googleCloudBuild: {}

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.