-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OpenShift WIP - still partially complete, but need to commit to OS ca…
…n pull down
- Loading branch information
Showing
7 changed files
with
194 additions
and
6 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,18 @@ | ||
FROM nginx:stable | ||
|
||
RUN chmod g+rwx /var/cache/nginx /var/run /var/log/nginx | ||
# users are not allowed to listen on priviliged ports | ||
# RUN sed -i.bak 's/listen\(.*\)80;/listen 8081;/' /etc/nginx/conf.d/default.conf | ||
EXPOSE 8081 | ||
# comment user directive as master process is run as user in OpenShift anyhow | ||
# RUN sed -i.bak 's/^user/#user/' /etc/nginx/nginx.conf | ||
COPY ./nginx.conf.template /etc/nginx/nginx.conf | ||
|
||
|
||
WORKDIR /code | ||
|
||
COPY ./dist . | ||
|
||
EXPOSE 8080:8080 | ||
|
||
CMD ["nginx", "-g", "daemon off;"] |
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,48 @@ | ||
worker_processes auto; | ||
error_log /var/log/nginx/error.log warn; | ||
# pid /var/run/nginx.pid; # ORIG | ||
pid /tmp/nginx.pid; # from OpenShift.com blog | ||
events { | ||
worker_connections 1024; | ||
} | ||
http { | ||
include /etc/nginx/mime.types; | ||
|
||
# Set custom paths for OpenShift permissions (non root) | ||
client_body_temp_path /tmp/client_temp; | ||
proxy_temp_path /tmp/proxy_temp_path; | ||
fastcgi_temp_path /tmp/fastcgi_temp; | ||
uwsgi_temp_path /tmp/uwsgi_temp; | ||
scgi_temp_path /tmp/scgi_temp; | ||
|
||
|
||
default_type application/octet-stream; | ||
log_format main '$remote_addr - $remote_user [$time_local] "$request" ' | ||
'$status $body_bytes_sent "$http_referer" ' | ||
'"$http_user_agent" "$http_x_forwarded_for"'; | ||
access_log /var/log/nginx/access.log main; | ||
sendfile on; | ||
keepalive_timeout 65; | ||
server { | ||
listen 8080; | ||
server_name localhost; | ||
location / { | ||
root /app; | ||
index index.html; | ||
try_files $uri $uri/ /index.html; | ||
} | ||
error_page 500 502 503 504 /50x.html; | ||
location = /50x.html { | ||
root /usr/share/nginx/html; | ||
} | ||
|
||
# For status of ngnix service, OpenShift is configured to call this | ||
location /nginx_status { | ||
# Enable Nginx stats | ||
stub_status on; | ||
# No need to log this request, its just noise | ||
access_log off; | ||
} | ||
|
||
} | ||
} |
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 @@ | ||
# OpenShift | ||
|
||
|
||
|
||
## Initial Setup | ||
|
||
### Enable cross-project pulling of ImageStreams (e.g. from tools -> dev) | ||
|
||
|
||
Run below 3 times, one for `dev`, `test`, `prod` | ||
|
||
oc policy add-role-to-group \ | ||
system:image-puller system:serviceaccounts:aifsul-dev \ | ||
--namespace=aifsul-tools |
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,98 @@ | ||
--- | ||
kind: Template | ||
apiVersion: v1 | ||
metadata: | ||
name: timemachine-web | ||
namespace: aifsul-tools | ||
creationTimestamp: | ||
objects: | ||
|
||
# Two image-streams. "-vue" is intermediate stream used for chain build | ||
- kind: ImageStream | ||
apiVersion: v1 | ||
metadata: | ||
name: "${NAME}-vue" | ||
- kind: ImageStream | ||
apiVersion: v1 | ||
metadata: | ||
name: "${NAME}" | ||
|
||
# Build-configs. First is intermediate build | ||
- kind: BuildConfig | ||
apiVersion: v1 | ||
metadata: | ||
name: "${NAME}-vue" | ||
creationTimestamp: | ||
labels: | ||
app: "${NAME}-vue" | ||
spec: | ||
runPolicy: Serial | ||
completionDeadlineSeconds: 1800 | ||
triggers: | ||
- type: ImageChange | ||
source: | ||
type: Git | ||
git: | ||
uri: "${GIT_SOURCE_URL}" | ||
ref: "${GIT_REFERENCE}" | ||
contextDir: "${CONTEXT_DIR}" | ||
strategy: | ||
type: Docker | ||
output: | ||
to: | ||
kind: ImageStreamTag | ||
name: "${NAME}-vue:latest" | ||
status: | ||
lastVersion: 0 | ||
|
||
|
||
# Create the vue-on-nginx final build | ||
- kind: BuildConfig | ||
apiVersion: v1 | ||
metadata: | ||
name: ${NAME} | ||
spec: | ||
output: | ||
to: | ||
kind: ImageStreamTag | ||
name: ${NAME}:latest | ||
source: | ||
type: Dockerfile | ||
contextDir: openshift/templates/nginx | ||
images: | ||
- from: | ||
kind: ImageStreamTag | ||
name: ${NAME}-vue:latest | ||
paths: | ||
# Is this path modified by contextDir above? If so, remove contextDir and replace | ||
# with dockerFilePath | ||
- sourcePath: /dist | ||
destinationDir: "." | ||
strategy: | ||
type: Docker | ||
triggers: | ||
- imageChange: {} | ||
type: ImageChange | ||
|
||
|
||
parameters: | ||
- name: NAME | ||
displayName: Name | ||
description: The name assigned to all of the objects defined in this template. | ||
required: true | ||
value: timemachine-web | ||
- name: GIT_SOURCE_URL | ||
displayName: GIT Source Repo URL | ||
description: A GIT URL to your source code. | ||
required: true | ||
value: https://github.com/bcgov/Project-and-time-tracker.git | ||
- name: GIT_REFERENCE | ||
displayName: Git Reference | ||
description: Optional branch, tag, or commit. | ||
required: true | ||
value: master | ||
- name: CONTEXT_DIR | ||
displayName: contextDir | ||
description: Sub directory, e.g. `api/` or `web/` | ||
required: true | ||
value: web/ |
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