-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
modification of quarry to allow for deployment to minikube. Additional changes will be needed when k8s is available in production to allow for production to be deployed to k8s. ** Do not deploy this ** Bug: T301469
- Loading branch information
1 parent
822379a
commit 963b9fd
Showing
28 changed files
with
493 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
FROM mariadb:10.4-focal | ||
|
||
COPY replica.sql /docker-entrypoint-initdb.d/replica.sql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Patterns to ignore when building packages. | ||
# This supports shell glob matching, relative path matching, and | ||
# negation (prefixed with !). Only one pattern per line. | ||
.DS_Store | ||
# Common VCS dirs | ||
.git/ | ||
.gitignore | ||
.bzr/ | ||
.bzrignore | ||
.hg/ | ||
.hgignore | ||
.svn/ | ||
# Common backup files | ||
*.swp | ||
*.bak | ||
*.tmp | ||
*.orig | ||
*~ | ||
# Various IDEs | ||
.project | ||
.idea/ | ||
*.tmproj | ||
.vscode/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
apiVersion: v2 | ||
description: A Helm chart for quarry | ||
name: helm-quarry | ||
version: "1.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
localdev: | ||
enabled: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# The OAUTH tokens are callbacks to a quarry.local domain | ||
# it is ok that they are public. | ||
OAUTH_CONSUMER_TOKEN: "deeb8dbabbf157cb0ed120b89971d800" | ||
OAUTH_SECRET_TOKEN: "38fdce038bbf848453a856aa329f8a06c456c791" | ||
SECRET_KEY: 'aaarggghhpleaserescuemeiamstuckinarandomnumbergeneratorfactory' | ||
DEBUG: True | ||
DB_HOST: 'db' | ||
DB_NAME: 'quarry' | ||
DB_USER: 'quarry' | ||
DB_PASSWORD: 'quarry' | ||
broker_url: 'redis://redis' | ||
result_backend: 'redis://redis' | ||
worker_concurrency: 24 # Since all tasks are IO bound | ||
task_acks_late: True # Tasks are idempotent! | ||
task_track_started: True | ||
worker_prefetch_multiplier: 1 # Tasks can run for a long time | ||
# Just query the quarry database itself. | ||
REPLICA_DOMAIN: '' | ||
REPLICA_HOST: 'mywiki' | ||
REPLICA_DB: 'mywiki_p' | ||
REPLICA_USER: 'repl' | ||
REPLICA_PASSWORD: 'repl' | ||
REPLICA_PORT: 3306 | ||
OUTPUT_PATH_TEMPLATE: '/results/%s/%s/%s.sqlite' | ||
REDIS_HOST: 'redis' | ||
REDIS_PORT: 6379 | ||
REDIS_DB: 0 | ||
QUERY_TIME_LIMIT: 60 # 1 minute | ||
QUERY_RESULTS_PER_PAGE: 50 | ||
KILLER_LOG_PATH: 'killer.log' | ||
MAINTENANCE_MSG: 'This is your local development environment.' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
localdev: | ||
enabled: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
## Replace these with prod values and encrypt | ||
|
||
# The OAUTH tokens are callbacks to a quarry.local domain | ||
# it is ok that they are public. | ||
OAUTH_CONSUMER_TOKEN: "deeb8dbabbf157cb0ed120b89971d800" | ||
OAUTH_SECRET_TOKEN: "38fdce038bbf848453a856aa329f8a06c456c791" | ||
SECRET_KEY: 'aaarggghhpleaserescuemeiamstuckinarandomnumbergeneratorfactory' | ||
DEBUG: True | ||
DB_HOST: 'db' | ||
DB_NAME: 'quarry' | ||
DB_USER: 'quarry' | ||
DB_PASSWORD: 'quarry' | ||
broker_url: 'redis://redis' | ||
result_backend: 'redis://redis' | ||
worker_concurrency: 24 # Since all tasks are IO bound | ||
task_acks_late: True # Tasks are idempotent! | ||
task_track_started: True | ||
worker_prefetch_multiplier: 1 # Tasks can run for a long time | ||
# Just query the quarry database itself. | ||
REPLICA_DOMAIN: '' | ||
REPLICA_HOST: 'mywiki' | ||
REPLICA_DB: 'mywiki_p' | ||
REPLICA_USER: 'repl' | ||
REPLICA_PASSWORD: 'repl' | ||
REPLICA_PORT: 3306 | ||
OUTPUT_PATH_TEMPLATE: '/results/%s/%s/%s.sqlite' | ||
REDIS_HOST: 'redis' | ||
REDIS_PORT: 6379 | ||
REDIS_DB: 0 | ||
QUERY_TIME_LIMIT: 60 # 1 minute | ||
QUERY_RESULTS_PER_PAGE: 50 | ||
KILLER_LOG_PATH: 'killer.log' | ||
MAINTENANCE_MSG: 'This is your local development environment.' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
Thank you for installing {{ .Chart.Name }}! | ||
|
||
An essential part of setting up your dev environment is adding a hosts file entry. | ||
Get the IP of minikube with: | ||
minikube ip | ||
Add this line to your hosts file: | ||
<ip address> quarry.local | ||
|
||
You can override any values you need in a file called dev-values.yaml. | ||
|
||
If you create one, run: | ||
helm -n {{ .Release.Namespace }} upgrade {{ .Release.Name }} helm-quarry/ -f dev-values.yaml | ||
Happy hacking. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: config | ||
data: | ||
{{ if .Values.localdev.enabled }} | ||
config.yaml: {{ .Files.Get "dev_config.yaml" | quote }} | ||
{{ else }} | ||
config.yaml: {{ .Files.Get "prod_config.yaml" | quote }} | ||
{{ end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: db | ||
labels: | ||
app: db | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: db | ||
template: | ||
metadata: | ||
labels: | ||
app: db | ||
spec: | ||
containers: | ||
- name: db | ||
image: mariadb:10.1.48-bionic | ||
imagePullPolicy: Always | ||
env: | ||
- name: MYSQL_USER | ||
value: "quarry" | ||
- name: MYSQL_PASSWORD | ||
value: "quarry" | ||
- name: MYSQL_DATABASE | ||
value: "quarry" | ||
- name: MYSQL_RANDOM_ROOT_PASSWORD | ||
value: "1" | ||
volumeMounts: | ||
- name: schema | ||
mountPath: /docker-entrypoint-initdb.d/ | ||
volumes: | ||
- name: schema | ||
configMap: | ||
name: db-schema |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: db-schema | ||
data: | ||
schema.sql: | | ||
CREATE DATABASE IF NOT EXISTS quarry CHARACTER SET utf8; | ||
USE quarry; | ||
CREATE TABLE IF NOT EXISTS user( | ||
id INT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, | ||
username VARCHAR(255) BINARY NOT NULL UNIQUE, | ||
wiki_uid INT UNSIGNED NOT NULL UNIQUE | ||
); | ||
CREATE UNIQUE INDEX IF NOT EXISTS user_username_index ON user( username); | ||
CREATE UNIQUE INDEX IF NOT EXISTS user_wiki_uid ON user(wiki_uid); | ||
CREATE TABLE IF NOT EXISTS user_group( | ||
id INT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, | ||
user_id INT UNSIGNED NOT NULL, | ||
group_name VARCHAR(255) BINARY NOT NULL | ||
); | ||
CREATE INDEX IF NOT EXISTS user_group_user_group_index ON user_group(user_id, group_name); | ||
CREATE INDEX IF NOT EXISTS user_group_user_id_index ON user_group(user_id); | ||
CREATE INDEX IF NOT EXISTS user_group_group_name_index ON user_group(group_name); | ||
CREATE TABLE IF NOT EXISTS query( | ||
id INT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, | ||
user_id INT UNSIGNED NOT NULL, | ||
title VARCHAR(1024) BINARY, | ||
latest_rev_id INT UNSIGNED, | ||
last_touched TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, | ||
published SMALLINT DEFAULT 0 NOT NULL, | ||
description TEXT BINARY, | ||
parent_id INT UNSIGNED | ||
); | ||
CREATE INDEX IF NOT EXISTS query_parent_id_index ON query(parent_id); | ||
CREATE TABLE IF NOT EXISTS query_revision( | ||
id INT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, | ||
text TEXT BINARY NOT NULL, | ||
query_database VARCHAR(1024) BINARY, | ||
query_id INT UNSIGNED NOT NULL, | ||
latest_run_id INT UNSIGNED, | ||
timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP | ||
); | ||
CREATE INDEX IF NOT EXISTS query_rev_query_id_index ON query_revision(query_id); | ||
CREATE INDEX IF NOT EXISTS query_rev_query_database_index ON query_revision(query_database); | ||
CREATE TABLE IF NOT EXISTS query_run( | ||
id INT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, | ||
query_rev_id INT UNSIGNED NOT NULL, | ||
status TINYINT UNSIGNED NOT NULL DEFAULT 0, | ||
timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP, | ||
task_id VARCHAR(36) BINARY, | ||
extra_info TEXT BINARY | ||
); | ||
CREATE INDEX IF NOT EXISTS query_run_status_index ON query_run(status); | ||
CREATE TABLE IF NOT EXISTS star( | ||
id INT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, | ||
user_id INT UNSIGNED NOT NULL, | ||
query_id INT UNSIGNED NOT NULL, | ||
timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP | ||
); | ||
CREATE INDEX IF NOT EXISTS star_user_id_index ON star(user_id); | ||
CREATE INDEX IF NOT EXISTS star_query_id_index ON star(query_id); | ||
CREATE UNIQUE INDEX IF NOT EXISTS star_user_query_index ON star(user_id, query_id); | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: db | ||
spec: | ||
selector: | ||
app: db | ||
ports: | ||
- name: db | ||
port: 3306 | ||
targetPort: 3306 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: mywiki | ||
labels: | ||
app: mywiki | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: mywiki | ||
template: | ||
metadata: | ||
labels: | ||
app: mywiki | ||
spec: | ||
containers: | ||
- name: mywiki | ||
image: mywiki:01 # replace with quay.io | ||
imagePullPolicy: Never | ||
env: | ||
- name: MYSQL_USER | ||
value: "repl" | ||
- name: MYSQL_PASSWORD | ||
value: "repl" | ||
- name: MYSQL_DATABASE | ||
value: "repl" | ||
- name: MYSQL_RANDOM_ROOT_PASSWORD | ||
value: "1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: mywiki | ||
spec: | ||
selector: | ||
app: mywiki | ||
ports: | ||
- name: mywiki | ||
port: 3306 | ||
targetPort: 3306 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: redis | ||
labels: | ||
app: redis | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: redis | ||
template: | ||
metadata: | ||
labels: | ||
app: redis | ||
spec: | ||
containers: | ||
- name: redis | ||
image: redis:alpine | ||
imagePullPolicy: Always |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: redis | ||
spec: | ||
selector: | ||
app: redis | ||
ports: | ||
- name: redis | ||
port: 6379 | ||
targetPort: 6379 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
apiVersion: v1 | ||
kind: PersistentVolume | ||
metadata: | ||
name: results | ||
spec: | ||
storageClassName: manual | ||
capacity: | ||
storage: 1Gi | ||
accessModes: | ||
- ReadWriteMany | ||
hostPath: | ||
path: "/results" |
Oops, something went wrong.