-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add cluster local postgres deployment #50
Open
arajkumar
wants to merge
3
commits into
fabric8-analytics:master
Choose a base branch
from
arajkumar:cluster-local-postgres
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -98,3 +98,4 @@ target/ | |
openshift/config.yaml | ||
openshift/secrets.yaml | ||
openshift/env.sh | ||
openshift/rds.json |
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 |
---|---|---|
|
@@ -37,12 +37,6 @@ is_set_or_fail AWS_SECRET_ACCESS_KEY "${AWS_SECRET_ACCESS_KEY}" | |
is_set_or_fail AWS_DEFAULT_REGION "${AWS_DEFAULT_REGION}" | ||
is_set_or_fail OC_TOKEN "${OC_TOKEN}" | ||
|
||
templates_dir="${here}/templates" | ||
templates="fabric8-analytics-jobs fabric8-analytics-server fabric8-analytics-data-model | ||
fabric8-analytics-worker fabric8-analytics-pgbouncer gremlin-docker | ||
fabric8-analytics-license-analysis fabric8-analytics-stack-analysis | ||
f8a-server-backbone fabric8-analytics-stack-report-ui fabric8-analytics-api-gateway" | ||
|
||
purge_aws_resources=false # default | ||
for key in "$@"; do | ||
case $key in | ||
|
@@ -57,47 +51,25 @@ for key in "$@"; do | |
done | ||
[ "$purge_aws_resources" == false ] && echo "Use --purge-aws-resources if you want to also clear previously allocated AWS resources (RDS database, SQS queues, S3 buckets, DynamoDB tables)." | ||
|
||
openshift_login | ||
# openshift_login | ||
create_or_reuse_project | ||
allocate_aws_rds | ||
generate_and_deploy_config | ||
deploy_secrets | ||
|
||
#Get templates for fabric8-analytics projects | ||
for template in ${templates} | ||
do | ||
curl -sS "https://raw.githubusercontent.com/fabric8-analytics/${template}/master/openshift/template.yaml" > "${templates_dir}/${template#fabric8-analytics-}.yaml" | ||
done | ||
github_org_base="https://raw.githubusercontent.com/fabric8-analytics" | ||
openshift_template_path="master/openshift/template.yaml" | ||
openshift_template_path2="master/openshift/template-prod.yaml" | ||
|
||
oc_process_apply "${templates_dir}/pgbouncer.yaml" | ||
sleep 20 | ||
oc_process_apply "${templates_dir}/gremlin-docker.yaml" "-p CHANNELIZER=http -p REST_VALUE=1 -p IMAGE_TAG=latest" | ||
sleep 20 | ||
oc_process_apply "${templates_dir}/gremlin-docker.yaml" "-p CHANNELIZER=http -p REST_VALUE=1 -p IMAGE_TAG=latest -p QUERY_ADMINISTRATION_REGION=ingestion" | ||
sleep 20 | ||
oc_process_apply "${templates_dir}/data-model.yaml" | ||
sleep 20 | ||
oc_process_apply "${templates_dir}/jobs.yaml" | ||
sleep 20 | ||
oc_process_apply "${templates_dir}/worker.yaml" "-p WORKER_ADMINISTRATION_REGION=ingestion -p WORKER_EXCLUDE_QUEUES=GraphImporterTask" | ||
sleep 20 | ||
oc_process_apply "${templates_dir}/worker.yaml" "-p WORKER_ADMINISTRATION_REGION=ingestion -p WORKER_INCLUDE_QUEUES=GraphImporterTask -p WORKER_NAME_SUFFIX=-graph-import" | ||
sleep 20 | ||
Comment on lines
-80
to
-85
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Only bare minimum services to support online flow has been enabled. |
||
oc_process_apply "${templates_dir}/worker.yaml" "-p WORKER_ADMINISTRATION_REGION=api -p WORKER_RUN_DB_MIGRATIONS=1 -p WORKER_EXCLUDE_QUEUES=GraphImporterTask" | ||
sleep 20 | ||
oc_process_apply "${templates_dir}/worker.yaml" "-p WORKER_ADMINISTRATION_REGION=api -p WORKER_INCLUDE_QUEUES=GraphImporterTask -p WORKER_NAME_SUFFIX=-graph-import" | ||
sleep 20 | ||
oc_process_apply "${templates_dir}/f8a-server-backbone.yaml" | ||
sleep 20 | ||
oc_process_apply "${templates_dir}/server.yaml" | ||
sleep 20 | ||
oc_process_apply "${templates_dir}/stack-analysis.yaml" "-p KRONOS_SCORING_REGION=maven" | ||
# kronos-pypi is not used/maintained now | ||
# sleep 20 | ||
# oc_process_apply "${templates_dir}/stack-analysis.yaml" "-p KRONOS_SCORING_REGION=pypi" | ||
sleep 20 | ||
oc_process_apply "${templates_dir}/license-analysis.yaml" | ||
sleep 20 | ||
oc_process_apply "${templates_dir}/stack-report-ui.yaml" "-p REPLICAS=1" | ||
oc_process_apply "${github_org_base}/fabric8-analytics-pgbouncer/${openshift_template_path}" | ||
oc_process_apply "${github_org_base}/gremlin-docker/${openshift_template_path}" "-p CHANNELIZER=http -p REST_VALUE=1 -p IMAGE_TAG=latest" | ||
oc_process_apply "${github_org_base}/gremlin-docker/${openshift_template_path}" "-p CHANNELIZER=http -p REST_VALUE=1 -p IMAGE_TAG=latest -p QUERY_ADMINISTRATION_REGION=ingestion" | ||
sleep 20 | ||
oc_process_apply "${templates_dir}/api-gateway.yaml" | ||
oc_process_apply "${github_org_base}/fabric8-analytics-data-model/${openshift_template_path}" | ||
oc_process_apply "${github_org_base}/fabric8-analytics-worker/${openshift_template_path}" "-p WORKER_ADMINISTRATION_REGION=api -p WORKER_RUN_DB_MIGRATIONS=1 -p WORKER_EXCLUDE_QUEUES=GraphImporterTask" | ||
oc_process_apply "${github_org_base}/f8a-server-backbone/${openshift_template_path}" | ||
oc_process_apply "${github_org_base}/fabric8-analytics-server/${openshift_template_path}" | ||
oc_process_apply "${github_org_base}/fabric8-analytics-license-analysis/${openshift_template_path}" | ||
oc_process_apply "${github_org_base}/fabric8-analytics-npm-insights/${openshift_template_path}" | ||
oc_process_apply "${github_org_base}/f8a-pypi-insights/${openshift_template_path}" | ||
oc_process_apply "${github_org_base}/f8a-hpf-insights/${openshift_template_path2}" "-p HPF_SCORING_REGION=maven -p RESTART_POLICY=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
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,77 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: f8a-postgres | ||
labels: | ||
f8a-component: f8a-postgres | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
f8a-component: f8a-postgres | ||
template: | ||
metadata: | ||
labels: | ||
f8a-component: f8a-postgres | ||
spec: | ||
volumes: | ||
- name: postgres-data | ||
persistentVolumeClaim: | ||
claimName: f8a-postgres | ||
containers: | ||
- name: postgres | ||
image: postgres:9.6 | ||
imagePullPolicy: "IfNotPresent" | ||
ports: | ||
- containerPort: 5432 | ||
env: | ||
- name: POSTGRES_USER | ||
valueFrom: | ||
secretKeyRef: | ||
key: username | ||
name: coreapi-postgres | ||
- name: POSTGRES_DB | ||
valueFrom: | ||
secretKeyRef: | ||
key: database | ||
name: coreapi-postgres | ||
- name: POSTGRES_PASSWORD | ||
valueFrom: | ||
secretKeyRef: | ||
key: password | ||
name: coreapi-postgres | ||
- name: PGDATA | ||
value: "/var/lib/postgres/data/f8a" | ||
volumeMounts: | ||
- name: postgres-data | ||
mountPath: "/var/lib/postgres/data" | ||
--- | ||
apiVersion: v1 | ||
kind: PersistentVolumeClaim | ||
metadata: | ||
name: f8a-postgres | ||
labels: | ||
f8a-component: f8a-postgres | ||
spec: | ||
accessModes: | ||
- "ReadWriteOnce" | ||
resources: | ||
requests: | ||
storage: "10Gi" | ||
volumeName: "f8a-postgres" | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: f8a-postgres | ||
labels: | ||
f8a-component: f8a-postgres | ||
spec: | ||
type: ClusterIP | ||
ports: | ||
- port: 5432 | ||
protocol: TCP | ||
name: postgres | ||
targetPort: 5432 | ||
selector: | ||
f8a-component: f8a-postgres |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
export KUBECONFIG=
..``oroc login ...
is a must.