Artifactory in docker- won't connect to postgres? - artifactory

I'm trying to launch artifactory within a container, and it won't seem to connect to my postgres database.
I am launching it like so:
docker run --network mynet --name artifactory -e JF_SHARED_DATABASE_DRIVER=org.postgresql.Driver -e JF_SHARED_DATABASE_URL="jdbc:postgresql://postgres:5432/artifactory" -e JF_SHARED_DATABASE_TYPE=postgresql -e JF_SHARED_DATABASE_HOST=postgres -e JF_SHARED_DATABASE_PORT=5432 -e JF_SHARED_DATABASE_USER=artifactory -e JF_SHARED_DATABASE_PASSWORD=password -p 9081:8081-i -t --rm docker.bintray.io/jfrog/artifactory-pro:7.10.2
The output it as such:
Preparing to run Artifactory in Docker
Running as uid=1030(artifactory) gid=1030(artifactory)
Dockerfile for this image can found inside the container.
To view the Dockerfile: 'cat /docker/artifactory-pro/Dockerfile.artifactory'.
Resolved JF_SHARED_DATABASE_TYPE (postgresql) from environment variable
Resolved JF_SHARED_DATABASE_URL (jdbc:postgresql://postgres:5432/artifactory) from environment variable
Waiting for DB postgresql to be ready on postgres/5432 for 30 second
This shouldn't take 30 seconds, so this is an immediate red flag.
Then after the 30s expires, I see many of these:
2020-10-16T13:19:48.662Z [jfmd ] [INFO ] [75be6b93f5c12126] [database_bearer.go:100 ] [main ] - Connecting to (db config: {postgresql jdbc:postgresql://postgres:5432/artifactory}) [database]
2020-10-16T13:19:48.671Z [jfmd ] [WARN ] [75be6b93f5c12126] [jobs.go:92 ] [main ] - [RETRY] Initiating database connection: pq: no PostgreSQL user name specified in startup packet. Retrying in 1s ... (1/120) [database]
The startup output confirms it is set:
JF_SHARED_NODE_NAME : da6d3e81a7c5
JF_SHARED_DATABASE_PORT : 5432
JF_SHARED_DATABASE_USER : artifactory
JF_SYSTEM_YAML : /opt/jfrog/artifactory/var/etc/system.yaml
JF_ARTIFACTORY_PID : /opt/jfrog/artifactory/app/run/artifactory.pid
JF_SHARED_DATABASE_TYPE : postgresql
JF_SHARED_DATABASE_PASSWORD : ******
JF_PRODUCT_DATA_INTERNAL : /var/opt/jfrog/artifactory
JF_PRODUCT_HOME : /opt/jfrog/artifactory
JF_ROUTER_TOPOLOGY_LOCAL_REQUIREDSERVICETYPES : jfrt,jfac,jfmd,jffe,jfevt
JF_SHARED_DATABASE_HOST : postgres
JF_SHARED_DATABASE_URL : jdbc:postgresql://postgres:5432/artifactory
JF_SHARED_DATABASE_DRIVER : org.postgresql.Driver
JF_SHARED_NODE_IP : 172.19.0.3
JF_SHARED_NODE_ID : da6d3e81a7c5
JF_ARTIFACTORY_USER : artifactory
Not sure where else to take this. Thanks for any help!

You are almost there,
you have a typo, it should be
JF_SHARED_DATABASE_USERNAME
and not
JF_SHARED_DATABASE_USER

Related

Artifactory in Docker produce errors during start

I'm newbie in Jfrog Artifactory and I having problems with starting the container with Artifactory.
It works, and I see the web-interface, but I'm concerned about the errors in the console.
Here is the docker-compose:
version: "3.9"
services:
artifactory:
image: docker.bintray.io/jfrog/artifactory-oss
container_name: artifactory
environment:
JF_SHARED_NODE_IP: "127.0.0.1"
JF_SHARED_NODE_ID: "artifactory"
JF_SHARED_NODE_NAME: "artifactory"
ports:
- 8082:8082
- 8081:8081
volumes:
- ./jfrog/artifactory/var/:/var/opt/jfrog/artifactory
- /etc/localtime:/etc/localtime:ro
logging:
driver: json-file
options:
max-size: "50m"
max-file: "10"
ulimits:
nproc: 65535
nofile:
soft: 32000
hard: 40000
Before I launch it, I execute the following:
sudo mkdir -p ./jfrog/artifactory/var/etc/
touch ./jfrog/artifactory/var/etc/system.yaml
chown -R 1030:1030 ./jfrog/artifactory/var
chmod -R 777 ./jfrog/artifactory/var
Here is the startup log:
artifactory_startup.log (sorry for uploading the log on Goggle Drive. It's too large for the stackoverflow post)
I'm concerned about these strings:
[jfac ] [WARN ] [976f1c9489fa2680] [c.z.h.u.DriverDataSource:70 ] [ocalhost-startStop-1] - Registered driver with driverClassName=org.apache.derby.jdbc.EmbeddedDriver was not found, trying direct instantiation.
[jfac ] [WARN ] [976f1c9489fa2680] [o.j.c.ExecutionUtils:165 ] [pool-8-thread-2 ] - Retry 10 Elapsed 5.22 secs failed: Registration with router on URL http://localhost:8046 failed with error: UNAVAILABLE: io exception. Trying again
[jfrt ] [ERROR] [ ] [o.j.c.w.FileWatcher:221 ] [Thread-6 ] - Unknown exception while watching for file changes: null
artifactory | java.lang.NullPointerException: null
artifactory | at org.jfrog.config.watch.FileWatcher.lambda$doWatch$2(FileWatcher.java:202)
artifactory | at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
artifactory | at org.jfrog.config.watch.FileWatcher.doWatch(FileWatcher.java:201)
artifactory | at java.base/java.lang.Thread.run(Thread.java:829)
[jfrou] [WARN ] [6424ea6f8b2dc101] [local_topology.go:256 ] [main ] - Readiness test failed with the following error: "required node services are missing or unhealthy"
Please, help me find out what these errors mean. Or I can just use the service and all is OK?
After some digging I've found out that Tomcat and JVM can't get enough CPU threads. The solution is to give more recourses to the containers. I've completely forgotten to read about system requirements.

Installing Xray and configure with Jfrog Artifactory using Docker compose

We were trying to Integrate Xray with our Jfrog Artifactory. In Amazon Linux 2 we are trying to install with docker compose,while we run the config.sh
After running the bellow docker compose commands
start rabbitmq: docker-compose -p xray-rabbitmq -f docker-compose-rabbitmq.yaml up -d
start postgresql: docker-compose -p xray-postgres -f docker-compose-postgres.yaml up -d
start: docker-compose -p xray up -d
xray router is getting restarting after 20sec with following error:
We have checked whether any selinux, firewalld, or iptables are blocking,but all are in disable state.
Can someone help us to resolve the issue?
Now Private IP is able to reach Artifactory server,we have created Xray in same VPC of Artifactory.
Now all containers of Xray are running in Xray server,but now we have a different issue.
In xray server container we are getting the below logs
2021-08-12T13:41:17.601Z [jfxr ] [INFO ] [469946e5f04dd2c6] [updates_service:486 ] [main ] Initializing JFrog vendor
2021-08-12T13:41:17.700Z [jfxr ] [ERROR] [ ] [bin_mgr_cache:50 ] [main ] Failed to get binary managerid:failed on GetAllBinaryManagerIds query
--- at /go/src/jfrog.com/xray/internal/dbaccess/dao/binary_managers_dao.go:367 (binMgrDao.GetBinaryManagerId) ---
Caused by: not found
2021-08-12T13:41:17.701Z [jfxr ] [ERROR] [ ] [bin_mgr_cache:59 ] [main ] Failed to get binary manager'' version, err :failed to fetch binary manager
--- at /go/src/jfrog.com/xray/internal/dbaccess/dao/binary_managers_dao.go:290 (binMgrDao.GetBinMgrByID) ---
Caused by: not found
2021-08-12T13:41:17.701Z [jfxr ] [WARN ] [ ] [indexed_resources_cache:36 ] [main ] Failed to get binary managerfor cache:failed to fetch binary manager
--- at /go/src/jfrog.com/xray/internal/dbaccess/dao/binary_managers_dao.go:290 (binMgrDao.GetBinMgrByID) ---
Caused by: not found
Any idea on this?
#praseeb It appears you are giving JFrogURL as the node IP of xray. It should be the reachable URL of artifactory from the xray machine, Please pick it from Admin > Security > Settings as indicated.
I had similar issue with some custom Docker Compose files.
It was a network issue, the containers (server, indexer, analysis, persist) did not start in the same network as the router. This occurs because I use docker-compose [...] --no-start.
With the --no-start option, the network_mode: service:router was ignored and the containers goes to the default bridge network. So they cannot communicate with the router on local ports (8046, etc).

Openstack/Packstack install error on CentOS 7

For the past few days, I've been trying to install Openstack with Packstack on Centos 7 running through Oracle's Virtual Box on my linux distro. I've downloaded the CentOS 7 DVD image, and installed the server with gui type (including some some features that I now can't remember) and ran these commands as root:
systemctl disable firewalld
systemctl stop firewalld
systemctl disable NetworkManager
systemctl stop NetworkManager
systemctl enable network
systemctl start network
At first, internet worked fine. After disabling and stopping the NetworkManager service, I couldn't access the internet anymore; I've edited the config file /etc/sysconfig/network-scripts/ifcfg-enp0s3 so that now it looks like this:
TYPE=Ethernet
PROXY_METHOD=no
DNS=yes
BROWSER_ONLY=no
BOOTPROTO=dhcp
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=enp0s3
NM_CONTROLLED=no
UUID=1ce94676-c997-4772-9253-a3ac48a7814f
DEVICE=enp0s3
ONBOOT=yes
HWADDR=08:00:27:A5:FA:0F
DNS1=208.67.222.222
DNS2=208.67.220.220
PEERDNS=no
DOMAIN=localdomain
And the /etc/resolv.conf file (which was empty btw) and added the lines:
nameserver 208.67.222.222
nameserver 208.67.220.220
search localdomain
After this, internet seems to be working fine on the VM, so I began installing packstack with the following commands (as root as always):
yum install -y centos-release-openstack-train
dnf update -y //dnf wasn't present, so I installed it.
dnf install -y openstack-packstack
There had been no issues to this point. Sorry for the long post, I'm trying to include everything I did.
Now, when I run (as root) packstack --allinone to install packstack I get the following output:
[root#localhost smaug]# packstack --allinone
Welcome to the Packstack setup utility
The installation log file is available at: /var/tmp/packstack/20210701-104910-If_Lz5/openstack-setup.log
Installing:
Clean Up [ DONE ]
Discovering ip protocol version [ DONE ]
Setting up ssh keys [ DONE ]
Preparing servers [ DONE ]
Pre installing Puppet and discovering hosts' details [ DONE ]
Preparing pre-install entries [ DONE ]
Setting up CACERT [ DONE ]
Preparing AMQP entries [ DONE ]
Preparing MariaDB entries [ DONE ]
Fixing Keystone LDAP config parameters to be undef if empty[ DONE ]
Preparing Keystone entries [ DONE ]
Preparing Glance entries [ DONE ]
Checking if the Cinder server has a cinder-volumes vg[ DONE ]
Preparing Cinder entries [ DONE ]
Preparing Nova API entries [ DONE ]
Creating ssh keys for Nova migration [ DONE ]
Gathering ssh host keys for Nova migration [ DONE ]
Preparing Nova Compute entries [ DONE ]
Preparing Nova Scheduler entries [ DONE ]
Preparing Nova VNC Proxy entries [ DONE ]
Preparing OpenStack Network-related Nova entries [ DONE ]
Preparing Nova Common entries [ DONE ]
Preparing Neutron API entries [ DONE ]
Preparing Neutron L3 entries [ DONE ]
Preparing Neutron L2 Agent entries [ DONE ]
Preparing Neutron DHCP Agent entries [ DONE ]
Preparing Neutron Metering Agent entries [ DONE ]
Checking if NetworkManager is enabled and running [ DONE ]
Preparing OpenStack Client entries [ DONE ]
Preparing Horizon entries [ DONE ]
Preparing Swift builder entries [ DONE ]
Preparing Swift proxy entries [ DONE ]
Preparing Swift storage entries [ DONE ]
Preparing Gnocchi entries [ DONE ]
Preparing Redis entries [ DONE ]
Preparing Ceilometer entries [ DONE ]
Preparing Aodh entries [ DONE ]
Preparing Puppet manifests [ DONE ]
Copying Puppet modules and manifests [ DONE ]
Applying 192.168.112.221_controller.pp
192.168.112.221_controller.pp: [ ERROR ]
Applying Puppet manifests [ ERROR ]
ERROR : Error appeared during Puppet run: 192.168.112.221_controller.pp
Notice: /Stage[main]/Nova::Db::Sync/Exec[nova-db-sync]/returns: Error: (pymysql.err.OperationalError) (1045, u"Access denied for user 'nova'#'192.168.112.221' (using password: YES)") (Background on this error at: http://sqlalche.me/e/e3q8)
You will find full trace in log /var/tmp/packstack/20210701-104910-If_Lz5/manifests/192.168.112.221_controller.pp.log
Please check log file /var/tmp/packstack/20210701-104910-If_Lz5/openstack-setup.log for more information
Additional information:
* Parameter CONFIG_NEUTRON_L2_AGENT: You have chosen OVN Neutron backend. Note that this backend does not support the VPNaaS or FWaaS services. Geneve will be used as the encapsulation method for tenant networks
* A new answerfile was created in: /root/packstack-answers-20210701-104911.txt
* Time synchronization installation was skipped. Please note that unsynchronized time on server instances might be problem for some OpenStack components.
* File /root/keystonerc_admin has been created on OpenStack client host 192.168.112.221. To use the command line tools you need to source the file.
* To access the OpenStack Dashboard browse to http://192.168.112.221/dashboard .
Please, find your login credentials stored in the keystonerc_admin in your home directory.
It seems a DBAPI Operational Error, as pointed by http://sqlalche.me/e/e3q8, but that seemed off for some reason (I didn't even complete the installation of openstack through packstack and the error message points to a kind of runtime error to my knowledge). Investigating the log file /var/tmp/packstack/20210701-104910-If_Lz5/manifests/192.168.112.221_controller.pp.log gave the following result:
[1;33mWarning: /Stage[main]/Aodh::Deps/Anchor[aodh::service::end]: Skipping because of failed dependencies[0m
[1;33mWarning: /Stage[main]/Placement::Deps/Anchor[placement::service::end]: Skipping because of failed dependencies[0m
[1;33mWarning: /Stage[main]/Keystone::Cron::Fernet_rotate/Cron[keystone-manage fernet_rotate]: Skipping because of failed dependencies[0m
[1;31mError: Failed to apply catalog: Execution of '/usr/bin/openstack domain list --quiet --format csv' returned 1: Unable to establish connection to http://127.0.0.1:5000/v3/domains?: HTTPConnectionPool(host='127.0.0.1', port=5000): Max retries exceeded with url: /v3/domains (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7ff001fce090>: Failed to establish a new connection: [Errno 111] Connection refused',)) (tried 36, for a total of 170 seconds)[0m
If I try to connect with telnet localhost 5000 I'm greeted by the following:
Trying ::1...
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
telnet: connect to address 127.0.0.1: Connection refused
However, everything seems fine if I connect normally without specifying the port.
If the connection is refused,I thought, then port 5000 is not open/nothing is listening on it. And so tried to open it and move on with the installation.
Here lies the arcanum: no matter what I do, the connection is always refused.
I tried to open the port to the loopback and the main internet device (enp0s3), but nothing. I tried, even if it dind't make sense, to restart the firewalld service to add the port with firewall-cmd --zone=public --add-port=5000/tcp --permanent and still the connection was refused with telnet.
iptables-save | grep 5000 yields the following:
-A INPUT -i lo -p tcp -m tcp --dport 5000 -j ACCEPT
-A INPUT -i enp0s3 -p tcp -m tcp --dport 5000 -j ACCEPT
-A INPUT -p tcp -m multiport --dports 5000 -m comment --comment "001 keystone incoming keystone" -j ACCEPT
Looking at this, there seems to be rules that allow communication on port 5000, but the connection is refused still and the install of openstack keeps halting.
To add some more info lsof -i :5000, ss -antup | grep 5000 and netstat -lntu | grep 5000 do not produce any output, so this means (If I understand correctly) that no process is listening on that port and/or that port is still closed.
I'm confused on what to do, can you help?
Thanks,

use saltstack state.sls to install mysql but not return

I am searching for a long time on net. But no use. Please help or try to give some ideas how to achieve this.
my saltstack file code in github
saltstack file
install mysql salt code:
[root#salt_master srv]# cat salt/base/lnmp_yum/mysql/mysql_install.sls
repo_init:
file.managed:
- name: /etc/yum.repos.d/mysql-{{pillar['mysql_version']}}.repo
- source: salt://lnmp_yum/mysql/files/mysql-{{pillar['mysql_version']}}.repo
- user: root
- group: root
- mode: 644
mysql_install:
pkg.installed:
- names:
- mysql
- mysql-server
- mysql-devel
- require:
- file: repo_init
service.running:
- name: mysqld
- enable: True
after run cmd:
salt 'lnmp_base' state.sls lnmp_yum.mysql.mysql_install -l debug
always print log:
[DEBUG ] Checking whether jid 20170526144936867490 is still running
[DEBUG ] Initializing new AsyncZeroMQReqChannel for ('/etc/salt/pki/master', 'salt_master_master', 'tcp://127.0.0.1:4506', 'clear')
[DEBUG ] Passing on saltutil error. This may be an error in saltclient. 'retcode'
[DEBUG ] Checking whether jid 20170526144936867490 is still running
[DEBUG ] Initializing new AsyncZeroMQReqChannel for ('/etc/salt/pki/master', 'salt_master_master', 'tcp://127.0.0.1:4506', 'clear')
[DEBUG ] Passing on saltutil error. This may be an error in saltclient. 'retcode'
[DEBUG ] Checking whether jid 20170526144936867490 is still running
[DEBUG ] Initializing new AsyncZeroMQReqChannel for ('/etc/salt/pki/master', 'salt_master_master', 'tcp://127.0.0.1:4506', 'clear')
[DEBUG ] Passing on saltutil error. This may be an error in saltclient. 'retcode'
when i look salt node server, mysql already installed and start,but salt master server always print log, no exit.
I searched for days, but I could not solve it.
the same question when i install jboss.
Thanks in advance.
Two thoughts occur to me:
I think mysql has a basic configuration ncurses gui that requires user input to configure (Set default password etc). If I remember that correctly then your salt state is still running and waiting for a human to type at the screen. You can fix this by feeding it an answer/config file.
Stolen shamelesly from another post:
sudo debconf-set-selections <<< 'mysql-server-5.6 mysql-server/root_password password your_password'
sudo debconf-set-selections <<< 'mysql-server-5.6 mysql-server/root_password_again password your_password'
sudo apt-get -y install mysql-server-5.6
The other is that it may simply take longer than your salt timeout default for a task. That can be configured in salt at the salt cmd line with -t or the config file (forget which setting)

Authentication failed with capifony

I'm trying to do a Symfony 2 project deployment web app based on capifony and Symfony2.
It uses Process to trigger my "cap deploy" task and display my output in a web browser.
When in a shell, if I run my "cap deploy" as user www-data (the same as used by Process) , my deployement works fine so there's nothing wrong either with my deploy task nor with my authentication keys.
Though, when I call my task from my web app, capifony tells me it can't authenticate on the remote server.
triggering start callbacks for `deploy'
* executing `deploy:setdomain'
* executing `deploy'
* executing `deploy:update'
** transaction: start
* executing `deploy:update_code'
triggering before callbacks for `deploy:update_code'
[32m--> Updating code base with checkout strategy[0m
executing locally: "git ls-remote [ myrepo ]"
command finished in 2068ms
* executing "git clone -q -o [ remote server ] [ my repo ]
/var/www/spinfony/releases/20121211100449 && cd /var/www/spinfony/releases/20121211100449 && git checkout -q -b deploy be53233e51a4c542c3bc8603b424e57f988898a4 && (echo be53233e51a4c542c3bc8603b424e57f988898a4 > /var/www/spinfony/releases/20121211100449/REVISION)"
servers: ["[ remote server ]"]
Password: stty: standard input: Invalid argument
stty: standard input: Invalid argument
stty: standard input: Invalid argument
*** [deploy:update_code] rolling back
* executing "rm -rf /var/www/spinfony/releases/20121211100449; true"
servers: ["[ remote server ]"]
** [deploy:update_code] exception while rolling back: Capistrano::ConnectionError, connection failed for: [ remote server ] (Net::SSH::AuthenticationFailed: [ user ])
connection failed for: [ remote server ] (Net::SSH::AuthenticationFailed: [ user ])
I'm trying to figure out why capifony seems to expect a password I can't provide since i'm not running it from a shell, whereas when I do run it from a shell, it works fine without asking me anything.
Once again, the same file is called from the same user.
This is a known "bug"
You need to tell capistrano wich key to use
Try adding this to your deploy.rb :
ssh_options[:keys] = %w(/what/ever/.ssh/id_rsa)
Source : http://adam.goucher.ca/?p=1253
When you call your task from a web app, you need to tell it what user to use.
set :user, "www-data"
set :domain, "webserverdomainname.com"

Resources