-
Notifications
You must be signed in to change notification settings - Fork 5
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
New allinone installation for gcp #18
Open
javilinux
wants to merge
2
commits into
ruromero:master
Choose a base branch
from
javilinux:master
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
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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 |
---|---|---|
@@ -1,61 +1,38 @@ | ||
# Google Cloud setup | ||
|
||
*UPDATE: Now using [installcentos](https://github.com/gshipley/installcentos) to have a full 1 node installation.* | ||
|
||
You can find instructions to install google cloud sdk [here](https://cloud.google.com/sdk/downloads#yum). | ||
|
||
You have to add your [ssh keys](https://cloud.google.com/compute/docs/instances/adding-removing-ssh-keys). | ||
|
||
Google Cloud full setup is beyond this project , but here you can find a few tips. | ||
|
||
#### Firewall rules: | ||
#### Firewall rule: | ||
``` | ||
gcloud compute firewall-rules create openshift-console --allow tcp:8443 --description "Allow incoming traffic on TCP port 8443" --direction INGRESS --target-tags openshift-console | ||
gcloud compute firewall-rules create default-allow-http --allow tcp:80 --description "Allow incoming traffic on TCP port 80" --direction INGRESS --target-tags default-allow-http | ||
gcloud compute firewall-rules create default-allow-https --allow tcp:443 --description "Allow incoming traffic on TCP port 443" --direction INGRESS --target-tags default-allow-https | ||
``` | ||
|
||
#### Create Instance: | ||
``` | ||
gcloud compute instances create instance1 --image-family centos-7 --image-project centos-cloud --machine-type g1-small --tags default-allow-http,default-allow-https,openshift-console | ||
gcloud compute instances create breakfix1 --image-family centos-7 --image-project centos-cloud --machine-type n1-standard-4 --tags http-server,https-server,openshift-console --zone europe-west1-b --boot-disk-size=20GB | ||
``` | ||
|
||
#### Prerrequisites: | ||
|
||
We will install and setup docker and a few other packages: | ||
``` | ||
yum install docker wget git screen -y | ||
cat << EOF > /etc/docker/daemon.json | ||
{ | ||
"insecure-registries": [ | ||
"172.30.0.0/16" | ||
] | ||
} | ||
EOF | ||
systemctl enable docker | ||
systemctl start docker | ||
``` | ||
|
||
Allow access to the web console port (8443): | ||
|
||
``` | ||
firewall-cmd --permanent --add-port=8443/tcp | ||
firewall-cmd --reload | ||
``` | ||
|
||
Download the openshift client: | ||
|
||
sed -zi 's/PermitRootLogin no\|$/PermitRootLogin yes/' /etc/ssh/sshd_config | ||
systemctl restart sshd | ||
export DOMAIN=$(curl -s -H "Metadata-Flavor: Google" http://metadata.google.internal/computeMetadata/v1/instance/network-interfaces/0/access-configs/0/external-ip).nip.io | ||
export USERNAME=bernard | ||
export PASSWORD=bernoulli | ||
``` | ||
curl -L --silent -o oc.tar.gz https://github.com/openshift/origin/releases/download/v3.9.0/openshift-origin-client-tools-v3.9.0-191fece-linux-64bit.tar.gz && mkdir /tmp/oc && tar -xvf oc.tar.gz -C /tmp/oc && find /tmp/oc -name "oc" -type f -exec mv {} /usr/bin \; && rm -rf /tmp/oc oc.tar.gz | ||
``` | ||
|
||
#### OpenShift cluster and projects | ||
|
||
Initiate oc cluster with the public ip of the instance: | ||
|
||
#### Install the one node cluster | ||
``` | ||
oc cluster up --public-hostname=$(curl -H "Metadata-Flavor: Google" http://metadata.google.internal/computeMetadata/v1/instance/network-interfaces/0/access-configs/0/external-ip) | ||
curl https://raw.githubusercontent.com/gshipley/installcentos/master/install-openshift.sh | INTERACTIVE=false /bin/bash | ||
``` | ||
|
||
Setup the openshift projects: | ||
#### Setup the openshift projects: | ||
|
||
``` | ||
oc adm new-project break-fix --display-name='Break & Fix' | ||
|
@@ -69,29 +46,15 @@ oc adm policy add-cluster-role-to-user cluster-admin -z online-oc -n tty | |
oc new-app -f tty-template.yaml -n tty | ||
``` | ||
|
||
The template files are located at the [break-fix](../break-fix/) | ||
The template files are located at the [templates directory](https://github.com/ruromero/break-fix/templates/) | ||
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. Use relative path |
||
|
||
# Accessing the application | ||
|
||
|
||
* **Manager Application** http://manager-app-break-fix.<your_ip>.nip.io | ||
* **Demo Application** http://demoapp-demo.<your_ip>.nip.io | ||
* **TTY** http://online-oc-tty.<your_ip>.nip.io | ||
|
||
``` | ||
for ip in `GCE_INI_PATH=~/.ansible/inventory/gce.ini ~/.ansible/inventory/gce.py --list --pretty | jq '._meta.hostvars[].gce_public_ip' -r` | ||
do | ||
echo MACHINE: $ip | ||
echo -e "Manager App:\thttp://manager-app-break-fix.$ip.nip.io" | ||
echo -e "demo app:\thttp://demoapp-demo.$ip.nip.io" | ||
echo -e "tty:\t\thttp://online-oc-tty.$ip.nip.io" | ||
done | ||
|
||
MACHINE: 35.204.135.118 | ||
Manager App: http://manager-app-break-fix.35.204.135.118.nip.io | ||
demo app: http://demoapp-demo.35.204.135.118.nip.io | ||
tty: http://online-oc-tty.35.204.135.118.nip.io | ||
MACHINE: 35.204.221.18 | ||
Manager App: http://manager-app-break-fix.35.204.221.18.nip.io | ||
demo app: http://demoapp-demo.35.204.221.18.nip.io | ||
tty: http://online-oc-tty.35.204.221.18.nip.io | ||
echo -e "Manager App:\thttp://manager-app-break-fix.apps.$DOMAIN\ndemo app:\thttp://demoapp-demo.apps.$DOMAIN\ntty:\t\thttp://online-oc-tty.apps.$DOMAIN" | ||
``` |
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,127 @@ | ||
apiVersion: v1 | ||
kind: Template | ||
metadata: | ||
creationTimestamp: null | ||
name: demoapp-template | ||
objects: | ||
- apiVersion: v1 | ||
kind: ImageStream | ||
metadata: | ||
labels: | ||
app: ${APP_NAME} | ||
name: ${APP_NAME} | ||
- apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
labels: | ||
app: ${APP_NAME} | ||
name: ${APP_NAME} | ||
spec: | ||
ports: | ||
- name: web | ||
port: 8080 | ||
selector: | ||
app: ${APP_NAME} | ||
- apiVersion: v1 | ||
kind: Route | ||
metadata: | ||
labels: | ||
app: ${APP_NAME} | ||
name: ${APP_NAME} | ||
spec: | ||
port: | ||
targetPort: web | ||
to: | ||
kind: Service | ||
name: ${APP_NAME} | ||
- apiVersion: v1 | ||
kind: BuildConfig | ||
metadata: | ||
labels: | ||
app: ${APP_NAME} | ||
name: ${APP_NAME} | ||
spec: | ||
nodeSelector: null | ||
output: | ||
to: | ||
kind: ImageStreamTag | ||
name: ${APP_NAME}:latest | ||
postCommit: {} | ||
resources: {} | ||
runPolicy: Serial | ||
source: | ||
contextDir: ${CONTEXT_DIR} | ||
git: | ||
uri: https://github.com/ruromero/break-fix | ||
type: Git | ||
strategy: | ||
sourceStrategy: | ||
from: | ||
kind: DockerImage | ||
name: ${BUILDER_IMAGE} | ||
type: Source | ||
triggers: | ||
- type: ConfigChange | ||
- imageChange: | ||
type: ImageChange | ||
- apiVersion: v1 | ||
kind: DeploymentConfig | ||
metadata: | ||
labels: | ||
app: ${APP_NAME} | ||
name: ${APP_NAME} | ||
spec: | ||
replicas: 1 | ||
selector: | ||
app: ${APP_NAME} | ||
deploymentconfig: ${APP_NAME} | ||
strategy: | ||
type: Recreate | ||
template: | ||
metadata: | ||
labels: | ||
app: ${APP_NAME} | ||
deploymentconfig: ${APP_NAME} | ||
spec: | ||
containers: | ||
- name: ${APP_NAME} | ||
image: ' ' | ||
readinessProbe: | ||
httpGet: | ||
path: / | ||
port: 8080 | ||
scheme: HTTP | ||
periodSeconds: 5 | ||
timeoutSeconds: 1 | ||
livenessProbe: | ||
httpGet: | ||
path: / | ||
port: 8080 | ||
scheme: HTTP | ||
timeoutSeconds: 1 | ||
triggers: | ||
- type: ConfigChange | ||
- imageChangeParams: | ||
automatic: true | ||
containerNames: | ||
- ${APP_NAME} | ||
from: | ||
kind: ImageStreamTag | ||
name: ${APP_NAME}:latest | ||
type: ImageChange | ||
parameters: | ||
- description: Break & Fix Application name | ||
displayName: Application name | ||
name: APP_NAME | ||
required: true | ||
value: demoapp | ||
- description: Where the demo application lays in the git Repository | ||
displayName: Context directory | ||
name: CONTEXT_DIR | ||
required: true | ||
value: demoapp | ||
- description: Base image used to build the Demo application | ||
displayName: Builder image | ||
name: BUILDER_IMAGE | ||
required: true | ||
value: centos/nodejs-6-centos7:latest |
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,81 @@ | ||
apiVersion: v1 | ||
kind: Template | ||
metadata: | ||
creationTimestamp: null | ||
name: manager-app-template | ||
objects: | ||
- apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: ${APP_NAME} | ||
- apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
labels: | ||
app: ${APP_NAME} | ||
name: ${APP_NAME} | ||
spec: | ||
ports: | ||
- name: web | ||
port: 8080 | ||
selector: | ||
app: ${APP_NAME} | ||
- apiVersion: v1 | ||
kind: Route | ||
metadata: | ||
labels: | ||
app: ${APP_NAME} | ||
name: ${APP_NAME} | ||
spec: | ||
port: | ||
targetPort: web | ||
to: | ||
kind: Service | ||
name: ${APP_NAME} | ||
- apiVersion: v1 | ||
kind: DeploymentConfig | ||
metadata: | ||
labels: | ||
app: ${APP_NAME} | ||
name: ${APP_NAME} | ||
spec: | ||
replicas: 1 | ||
selector: | ||
app: ${APP_NAME} | ||
deploymentconfig: ${APP_NAME} | ||
strategy: | ||
type: Recreate | ||
template: | ||
metadata: | ||
labels: | ||
app: ${APP_NAME} | ||
deploymentconfig: ${APP_NAME} | ||
spec: | ||
containers: | ||
- env: | ||
- name: SCOREBOARD_HOST | ||
value: ${SCOREBOARD_HOST} | ||
- name: SCOREBOARD_PORT | ||
value: ${SCOREBOARD_PORT} | ||
name: ${APP_NAME} | ||
image: ruromero/manager-app:3.9.0 | ||
imagePullPolicy: IfNotPresent | ||
serviceAccountName: ${APP_NAME} | ||
triggers: | ||
- type: ConfigChange | ||
parameters: | ||
- description: Break & Fix Application name | ||
displayName: Application name | ||
name: APP_NAME | ||
required: true | ||
value: manager-app | ||
- description: Scoreboard application host | ||
displayName: Scoreboard APP host | ||
name: SCOREBOARD_HOST | ||
required: true | ||
value: 35.204.123.207 | ||
- description: Scoreboard application port | ||
displayName: Scoreboard APP port | ||
name: SCOREBOARD_PORT | ||
required: true | ||
value: "8080" |
Oops, something went wrong.
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.
What are this credentials for?