devops
## install tomcat
[root@localhost opt]# tar -zxvf apache-tomcat-9.0.54.tar.gz
apache-tomcat-9.0.54/conf/
apache-tomcat-9.0.54/conf/catalina.policy
apache-tomcat-9.0.54/conf/catalina.properties
apache-tomcat-9.0.54/conf/context.xml
## setup tomcat (manager gui)
[root@localhost apache-tomcat-9.0.54]# cat conf/tomcat-users.xml
<role rolename="admin"/>
<role rolename="admin-gui"/>
<role rolename="admin-script"/>
<role rolename="manager"/>
<role rolename="manager-gui"/>
<role rolename="manager-script"/>
<role rolename="manager-jmx"/>
<role rolename="manager-status"/>
<user username="admin" password="admin" roles="admin,manager,admin-gui,admin-script,manager-gui,manager-script,manager-jmx,manager-status" />
## setup tomcat (access)
[root@localhost apache-tomcat-9.0.54]# cat webapps/manager/META-INF/context.xml
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<Context antiResourceLocking="false" privileged="true" >
<CookieProcessor className="org.apache.tomcat.util.http.Rfc6265CookieProcessor"
sameSiteCookies="strict" />
<!-- <Valve className="org.apache.catalina.valves.RemoteAddrValve"
allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1" />
-->
<Manager sessionAttributeValueClassNameFilter="java\.lang\.(?:Boolean|Integer|Long|Number|String)|org\.apache\.catalina\.filters\.CsrfPreventionFilter\$LruCache(?:\$1)?|java\.util\.(?:Linked)?HashMap"/>
</Context>
[root@localhost apache-tomcat-9.0.54]#
## download gitlab-runner
[root@localhost apache-tomcat-9.0.54]# curl -L --output /usr/local/bin/gitlab-runner "https://gitlab-runner-downloads.s3.amazonaws.com/latest/binaries/gitlab-runner-linux-amd64"
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 54.0M 100 54.0M 0 0 38330 0 0:24:37 0:24:37 --:--:-- 217k
[root@localhost apache-tomcat-9.0.54]#
[root@localhost apache-tomcat-9.0.54]# chmod +x /usr/local/bin/gitlab-runner
[root@localhost apache-tomcat-9.0.54]#
## exec gitlab-runner
[root@localhost apache-tomcat-9.0.54]# useradd --comment 'GitLab Runner' --create-home gitlab-runner --shell /bin/bash
[root@localhost apache-tomcat-9.0.54]#
[root@localhost apache-tomcat-9.0.54]# gitlab-runner install --user=gitlab-runner --working-directory=/home/gitlab-runner
Runtime platform arch=amd64 os=linux pid=7107 revision=e0218c92 version=14.3.2
[root@localhost apache-tomcat-9.0.54]#
[root@localhost apache-tomcat-9.0.54]# gitlab-runner start
Runtime platform arch=amd64 os=linux pid=7208 revision=e0218c92 version=14.3.2
[root@localhost apache-tomcat-9.0.54]#
## setup gitlab-runner
[root@localhost apache-tomcat-9.0.54]# gitlab-runner register
Runtime platform arch=amd64 os=linux pid=8378 revision=e0218c92 version=14.3.2
Running in system-mode.
Enter the GitLab instance URL (for example, https://gitlab.com/):
http://git.gnoti.com/
Enter the registration token:
8DDiRsonq2-M
Enter a description for the runner:
[localhost.localdomain]: tomcat
Enter tags for the runner (comma-separated):
tomcat9
Registering runner... succeeded runner=8DDiRson
Enter an executor: virtualbox, docker-ssh+machine, kubernetes, custom, docker, docker-ssh, parallels, shell, ssh, docker+machine:
Enter the SSH server address (for example, my.server.com):
Enter the SSH server port (for example, 22):
Enter the SSH user (for example, root):
Enter the SSH password (for example, docker.io):
Enter the path to the SSH identity file (for example, /home/user/.ssh/id_rsa):
Runner registered successfully. Feel free to start it, but if it's running already the config should be automatically reloaded!
[root@localhost apache-tomcat-9.0.54]#
## setup gitlab-runner
[root@localhost apache-tomcat-9.0.54]# gitlab-runner register
Runtime platform arch=amd64 os=linux pid=8378 revision=e0218c92 version=14.3.2
Running in system-mode.
## Update .gitlab-ci.yml file
stages:
- build
cache:
paths:
- .m2/repository
uild:
stage: build
script:
- mvn tomcat7:undeploy
- mvn tomcat7:deploy
after_script:
- echo 'build success!'
tags:
- tomcat9
## config maven
[root@localhost gitlab-runner]# wget https://archive.apache.org/dist/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz
--2021-10-18 08:10:43-- https://archive.apache.org/dist/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz
Resolving archive.apache.org (archive.apache.org)... 138.201.131.134, 2a01:4f8:172:2ec5::2
Connecting to archive.apache.org (archive.apache.org)|138.201.131.134|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 9506321 (9.1M) [application/x-gzip]
Saving to: ‘apache-maven-3.6.3-bin.tar.gz’
100%[=================================================================================================>] 9,506,321 3.67MB/s in 2.5s
2021-10-18 08:10:46 (3.67 MB/s) - ‘apache-maven-3.6.3-bin.tar.gz’ saved [9506321/9506321]
[root@localhost gitlab-runner]# ll
합계 18116
-rw-r--r--. 1 root root 9506321 7월 3 2020 apache-maven-3.6.3-bin.tar.gz
drwxrwxr-x. 6 gitlab-runner gitlab-runner 99 10월 13 13:34 apache-maven-3.8.3
-rw-rw-r--. 1 gitlab-runner gitlab-runner 9042049 9월 28 03:48 apache-maven-3.8.3-bin.tar.gz
drwxrwxr-x. 3 gitlab-runner gitlab-runner 22 10월 13 12:00 builds
[root@localhost gitlab-runner]# tar -zxvf apache-maven-3.6.3-bin.tar.gz
apache-maven-3.6.3/README.txt
apache-maven-3.6.3/LICENSE
apache-maven-3.6.3/NOTICE
apache-maven-3.6.3/lib/
## check version maven
[root@localhost opt]# export PATH=/opt/apache-maven-3.6.3/bin:$PATH
[root@localhost opt]# mvn --version
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /opt/apache-maven-3.6.3
Java version: 1.8.0_292, vendor: Red Hat, Inc., runtime: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.292.b10-1.el7_9.x86_64/jre
Default locale: ko_KR, platform encoding: UTF-8
OS name: "linux", version: "3.10.0-1160.31.1.el7.x86_64", arch: "amd64", family: "unix"
[root@localhost opt]#
## config path
vi /etc/profile.d/maven.sh
source /etc/profile.d/maven.sh
# Apache Maven Environment Variables
# MAVEN_HOME for Maven 1 - M2_HOME for Maven 2
export M2_HOME=/home/gitlab-runner/apache-maven-3.6.3/
export PATH=${M2_HOME}/bin:${PATH}
댓글
댓글 쓰기