Jfrog Artifactory 2019 using MySQL Database
JfrogArtifactory2019usingMySQLDatabase
Gotocreatethedatabase
/opt/artifactory/misc/db/createdb
catcreatedb_mysql.sql
CREATEDATABASEartdbCHARACTERSETutf8COLLATEutf8_bin;
GRANTALLONartdb.*TO'artifactory'@'localhost'IDENTIFIEDBY'password';
FLUSHPRIVILEGES;
ThenTrytoconnecttotheDB
Checkthedatabaseconfigurationfile
/opt/artifactory/misc/db/
>catmysql.properties
type=mysql
driver=com.mysql.jdbc.Driver
url=jdbc:mysql://localhost:3306/artdb?characterEncoding=UTF-8&elideSetAutoCommits=true
username=artifactory
password=password
DownloadtheMySQLconnector
https://mvnrepository.com/artifact/mysql/mysql-connector-java/5.1.47
Needtoputthejarinhere
/opt/artifactory/tomcat/lib
ItriedtoputeverythinginDocker,soherearesomeDockerthingrelatedtoDB
ADDconf/db.properties/tool/artifactory/etc/
ADDinstall/mysql-connector-java-5.1.47.jar/tool/artifactory/tomcat/lib/
type=mysql
driver=com.mysql.jdbc.Driver
url=jdbc:mysql://mysql.tools.cloud-snap.net:3306/artdb?characterEncoding=UTF-8&elideSetAutoCommits=true
username=artifactory
password=password
DownloadtheconnectorfromMAVEN
mysql-connector-java-5.1.47.jar
Indefault,DockerSystemwilluse8.8.8.8astheResolver,butitseemsnotworkingformyRDS.
CheckSystemResolver
>cat/etc/resolv.conf
nameserver127.0.0.53
optionsedns0
searchus-west-2.compute.internal
ChecktheDockerSystem
>cat/etc/resolv.conf
optionsedns0
searchus-west-2.compute.internal
nameserver8.8.8.8
nameserver8.8.4.4
Solution:
https://docs.docker.com/config/containers/container-networking/
Iputparametersinthedockerstartcommand
run:
dockerrun\
--dns=127.0.0.53\
-d\
-uroot\
-p$(PORT):8081\
-v$(shellpwd)/artifactory-data:/var/opt/jfrog/artifactory\
-v/cloudsnap/volumes/artifactory/m2:/tool/artifactory/m2\
-v/var/run/docker.sock:/var/run/docker.sock\
--name$(NAME)\
$(IMAGE):$(TAG)
IcannotsolvetheDNSissuewith--dns,
Iwilldirectlyinstallthatonthemachine,InstallJDK
>sudoadd-apt-repositoryppa:webupd8team/java
>sudoaptupdate
>sudoaptinstalloracle-java8-installer
ChangethetomcatPORTnumberhere
tomcat/conf/server.xml
MySQLdatastorageisworkingnow.
ButIwanttousesharedisk,andput2machinesrunningartifactoryandpointtothesameMySQLdatabase,butthenIget
master.key
java.lang.RuntimeException:master.keyfileismissing-timedoutwhilewaitingformaster.keyafter60seconds.Pleaseprovideitmanually
Solution:
https://jfrog.com/knowledge-base/how-to-recover-the-master-key/
Itseemsnotthecasethen,IcannotmakethesecondoneworkingbecauseIamusingafreeversion.ButifIstopthefirstoneandcopythesecuritydirectory,thenthesecondonewillwork.
Thedirectoryneedtobackupisasfollow
/opt/artifactory/etc/security
Limittheannoymoususer
https://jfrog.com/knowledge-base/how-can-i-allow-anonymous-user-access-to-specific-repositories-only/
Tomakethepinghealthlinkwork,weneedtoenabletheannoymoususer
curl-Ghttp://localhost:49100/artifactory/api/system/ping
GotoUI—>Admin—>Security—>General—>“AllowAnonymousAccess”checked
UI—>Admin—>Security—>Permissions—>Editthe“Anything”and“AnyRemote”permissiontargets.RemovingallpermissionsfortheAnonymoususer
References:
https://www.jfrog.com/confluence/display/RTF/Configuring+the+Database
https://jfrog.com/knowledge-base/what-is-the-best-practice-to-configure-a-health-check-for-artifactory-in-amazon-elb/
https://superuser.com/questions/272265/getting-curl-to-output-http-status-code
OlderBlog