`
sillycat
  • 浏览: 2564524 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

Jfrog Artifactory 2019 using MySQL Database

 
阅读更多
Jfrog Artifactory 2019 using MySQL Database


Go to create the database
/opt/artifactory/misc/db/createdb
cat createdb_mysql.sql
CREATE DATABASE artdb CHARACTER SET utf8 COLLATE utf8_bin;
GRANT ALL ON artdb.* TO 'artifactory'@'localhost' IDENTIFIED BY 'password';
FLUSH PRIVILEGES;
Then Try to connect to the DB
Check the database configuration file
/opt/artifactory/misc/db/
> cat mysql.properties
type=mysql
driver=com.mysql.jdbc.Driver
url=jdbc:mysql://localhost:3306/artdb?characterEncoding=UTF-8&elideSetAutoCommits=true
username=artifactory
password=password
Download the MySQL connector
https://mvnrepository.com/artifact/mysql/mysql-connector-java/5.1.47
Need to put the jar in here
/opt/artifactory/tomcat/lib
I tried to put everything in Docker, so here are some Docker thing related to DB
ADD  conf/db.properties /tool/artifactory/etc/
ADD  install/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
Download the connector from MAVEN
mysql-connector-java-5.1.47.jar
In default, Docker System will use 8.8.8.8 as the Resolver, but it seems not working for my RDS.
Check System Resolver
> cat /etc/resolv.conf
nameserver 127.0.0.53
options edns0
search us-west-2.compute.internal
Check the Docker System
> cat /etc/resolv.conf
options edns0
search us-west-2.compute.internal
nameserver 8.8.8.8
nameserver 8.8.4.4
Solution:
https://docs.docker.com/config/containers/container-networking/
I put parameters in the docker start command
run:
    docker run \
    --dns=127.0.0.53 \
    -d \
    -u root \
    -p $(PORT):8081 \
    -v $(shell pwd)/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)
I can not solve the DNS issue with - - dns,
I will directly install that on the machine, Install JDK
> sudo add-apt-repository ppa:webupd8team/java
> sudo apt update
> sudo apt install oracle-java8-installer
Change the tomcat PORT number here
tomcat/conf/server.xml
MySQL data storage is working now.
But I want to use share disk, and put 2 machines running artifactory and point to the same MySQL database, but then I get
master.key
java.lang.RuntimeException: master.key file is missing - timed out while waiting for master.key after 60 seconds. Please provide it manually
Solution:
https://jfrog.com/knowledge-base/how-to-recover-the-master-key/
It seems not the case then, I can not make the second one working because I am using a free version. But if I stop the first one and copy the security directory, then the second one will work.
The directory need to back up is as follow
/opt/artifactory/etc/security

Limit the annoymous user
https://jfrog.com/knowledge-base/how-can-i-allow-anonymous-user-access-to-specific-repositories-only/
To make the ping health link work, we need to enable the annoymous user
curl -G http://localhost:49100/artifactory/api/system/ping
Go to UI —> Admin —> Security —> General —> “Allow Anonymous Access” checked
UI —> Admin —> Security —> Permissions —> Edit the “Anything” and “Any Remote” permission targets. Removing all permissions for the Anonymous user
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
Older Blog
https://sillycat.iteye.com/blog/2437346
https://sillycat.iteye.com/blog/2431253

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics