본문 바로가기

CLOUD/Openshift

OCP 4.10.23 설치(openshift) - 8. GitLAB, 배포

반응형

Git 구성

 

구성 정보

mkdir -p /srv/gitlab/{config,logs,data}
chmod -R 777 /srv
 
podman run --detach \
 --hostname quay.maru.com\
 --publish 28443:443 --publish 28080:80 --publish 28022:22 \
 --name gitlab \
 --restart always \
 --volume /srv/gitlab/config:/etc/gitlab:Z \
 --volume /srv/gitlab/logs:/var/log/gitlab:Z \
 --volume /srv/gitlab/data:/var/opt/gitlab:Z \
 --privileged \
 gitlab/gitlab-ce:latest

 

확인

[root@registry ~]# podman run --detach  --hostname quay.maru.com --publish 28443:443 --publish 28080:80 --publish 28022:22  --name gitlab  --restart always  --volume /srv/gitlab/config:/etc/gitlab:Z  --volume /srv/gitlab/logs:/var/log/gitlab:Z  --volume /srv/gitlab/data:/var/opt/gitlab:Z  --privileged  gitlab/gitlab-ce:latest
✔ docker.io/gitlab/gitlab-ce:latest
Trying to pull docker.io/gitlab/gitlab-ce:latest...
Getting image source signatures
Copying blob 68738062a92a done
Copying blob 71d605039f0c done
Copying blob 6940a3637561 done
Copying blob d7bfe07ed847 done
Copying blob 74d5a6c60980 done
Copying blob 0aecde402e0f done
Copying blob bcab3b38ecf4 done
Copying blob 81d80ac1d74b done
Copying config 8f37a8253d done
Writing manifest to image destination
Storing signatures
efc969ab20bfb8f84c5c3cb1aaa32caab2c3452d81860206a2e8c378e7ce1602


[root@registry ~]# podman ps
CONTAINER ID  IMAGE                              COMMAND               CREATED             STATUS                            PORTS                                                                 NAMES
d8dd31a5aaae  docker.io/library/registry:2       /etc/docker/regis...  4 days ago          Up 2 days ago                     0.0.0.0:5000->5000/tcp                                                mirror-registry
efc969ab20bf  docker.io/gitlab/gitlab-ce:latest  /assets/wrapper       About a minute ago  Up About a minute ago (starting)  0.0.0.0:28022->22/tcp, 0.0.0.0:28080->80/tcp, 0.0.0.0:28443->443/tcp  gitlab

 

 

 

Password 변경

[root@registry ~]# podman exec -it efc969ab20bf /bin/bash
root@quay:/# cd /opt/gitlab/bin/
root@quay:/opt/gitlab/bin# gitlab-rails console
--------------------------------------------------------------------------------
 Ruby:         ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]
 GitLab:       15.2.1 (9d47ef35dff) FOSS
 GitLab Shell: 14.9.0
 PostgreSQL:   13.6
------------------------------------------------------------[ booted in 46.80s ]
Loading production environment (Rails 6.1.4.7)
irb(main):001:0> user = User.find_by(username: 'root')
=> #<User id:1 @root>
irb(main):002:0> user.password = 'qwe123!!'
=> "qwe123!!"
irb(main):003:0> user.password_confirmation = 'qwe123!!'
=> "qwe123!!"
irb(main):004:0> user.save
=> true

 

login

 

test 계정 생성

 

cli 환경에서 수정을 위해 clone

[root@registry ~]# git clone http://maru.ocp4.com:28080/maru/test.git
Cloning into 'test'...
remote: Enumerating objects: 6, done.
remote: Counting objects: 100% (6/6), done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 6 (delta 0), reused 0 (delta 0), pack-reused 0
Receiving objects: 100% (6/6), done.

 

push 

[root@registry test]# git push -u origin main
Enumerating objects: 4, done.
Counting objects: 100% (4/4), done.
Delta compression using up to 4 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 294 bytes | 294.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
To http://maru.ocp4.com:28080/maru/test.git
   c909690..861935d  main -> main
Branch 'main' set up to track remote branch 'main' from 'origin'.

 

push한 파일 확인

 

 

 

배포

 

배포할 app 생성

[root@registry ~]# oc new-app --name=test3 image-registry.openshift-image-registry.svc:5000/openshift/php-hello-dockerfile
warning: Cannot check if git requires authentication.
warning: Cannot find git. Ensure that it is installed and in your path. Git is required to work with git repositories.
--> Found container image 9c24143 (3 years old) from image-registry.openshift-image-registry.svc:5000 for "image-registry.openshift-image-registry.svc:5000/openshift/php-hello-dockerfile"

    Red Hat Universal Base Image 8
    ------------------------------
    The Universal Base Image is designed and engineered to be the base layer for all of your containerized applications, middleware and utilities. This base image is freely redistributable, but Red Hat only supports Red Hat technologies through subscriptions for Red Hat products. This image is maintained by Red Hat and updated regularly.

    Tags: base rhel8

    * An image stream tag will be created as "test3:latest" that will track this image

--> Creating resources ...
    imagestream.image.openshift.io "test3" created
    deployment.apps "test3" created
    service "test3" created
--> Success
    Application is not exposed. You can expose services to the outside world by executing one or more of the commands below:
     'oc expose service/test3'
    Run 'oc status' to view your app.

 

expose

[root@registry ~]# oc expose svc/test3
route.route.openshift.io/test3 exposed
[root@registry ~]# oc get route
NAME    HOST/PORT                              PATH   SERVICES   PORT       TERMINATION   WILDCARD
test3   test3-test-deploy.apps.maru.ocp4.com          test3      8080-tcp                 None

 

확인

 

 

 

반응형