You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Deploying and Managing Applications on OpenShift Cluster
Deploy the application from Git:xxxxxgit in the nodejs-helloworld folder to the source-build project on the OpenShift cluster. Application name: greet.
Fix the error build process.
Expose app and make sure you get the output from the apps.
oc login -u developer -p xxxx
oc new-project source-build
oc new-app --name greet --as-deployment-config ¥
--build-env npm_config_registry=http://xxxx/repository/nodejs nodejs:12~https://github.com/$RHT_OCP4_GITHUB_USER/DO288-apps#source-build ¥
--context-dir nodejs-helloworld
---> DEPLOY FAILED
git clone xxxxxgit
#Configure git config
git config --global user.email="developer@email.com"
git config --global user.name="developer"
cat ~/.gitconfig
[user]
name = developer
email = developer@email.com
git checkout master
git checkout -b source-build
git push -u origin source-build
oc logs bc/greet
--->error on xxxx.json
python -m json.tool xxxx.json
--->find the error syntax
vi xxxx.json
--->fix the syntax
git commit -a -m "xxxx"
git push
oc start-build greet
oc logs -f bc/greet
oc get pod
oc expose service greet
oc get route
curl <route-url>
--->Check the app from browser too
Dockerfile
Httpd-parent Dockerfile
FROM registry.access.redhat.com/ubi8/ubi:8.0
MAINTAINER Red Hat Training <training@redhat.com># DocumentRoot for Apache
ENV DOCROOT=/var/www/html
RUN yum install -y --no-docs --disableplugin=subscription-manager httpd && \
yum clean all --disableplugin=subscription-manager -y && \
echo"Hello from the httpd-parent container!">${DOCROOT}/index.html
# Allows child images to inject their own content into DocumentRoot
ONBUILD COPY src/ ${DOCROOT}/
EXPOSE 80
# This stuff is needed to ensure a clean start
RUN rm -rf /run/httpd && mkdir /run/httpd
# Run as the root user
USER root
# Launch httpd
CMD /usr/sbin/httpd -DFOREGROUND
Httpd-child Dockerfile
FROM <address/to/httpd-parent-dockerfile>
EXPOSE 8080
# Labels consumed by OpenShift
LABEL io.k8s.description="A basic Apache" ¥
io.k8s.display-name="Apache HTTP Server" ¥
io.openshift.expose-services="8080:http" ¥
io.openshift.tags="apache, httpd"# Optional#RUN yum install -y --no-docs --disableplugin=subscription-manager httpd && ¥# yum clean all -y --disableplugin=subscription-manager# Change webserver port to 8080
RUN sed -i "s/Listen 80/Listen 8080/g" /etc/httpd/conf/httpd.conf
# Permissions to allow container to run on OpenShift
RUN chgrp -R 0 /var/log/httpd /var/run/httpd && ¥
chmod -R g=u /var/log/httpd /var/run/httpd
# Ensure clean run (omit if already configured in parent-Dockerfile)
RUN rm -rf /run/httpd && mkdir /run/httpd
# Run as non-privileged user
USER 1001
# Launch httpd (omit if already configured in parent-Dockerfile)
CMD /usr/sbin/httpd -DFOREGROUND
Another variation for httpd24
FROM registry.access.redhat.com/rhscl/httpd-24-rhel7
COPY src/ /var/www/html/
RUN echo “THIS IS INFORMATION” > /var/www/html/info.html
EXPOSE 8080
LABEL io.k8s.description=“xxx” io.k8s.display-name=“xx” ¥
io.openshift.expose-service=“8080:http” io.openshift.tags=“xxx”
RUN sed -i ”s/Listen 80/Listen 8080/g” /etc/httpd/conf/httpd.conf
USER 1001
CMD run-httpd