netbox-docker icon indicating copy to clipboard operation
netbox-docker copied to clipboard

DBShell not available in docker image

Open 3bruno opened this issue 3 years ago • 1 comments

Current Behavior

I tried to use dbshell inside de netbox container, but it's not present.

Expected Behavior

Dbshell need to be present to make possible query database.

Docker Compose Version

3.4

Docker Version

Client:
 Version:           20.10.6-ce
 API version:       1.41
 Go version:        go1.13.15
 Git commit:        8728dd246c3a
 Built:             Tue Apr 27 09:45:18 2021
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server:
 Engine:
  Version:          20.10.6-ce
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.13.15
  Git commit:       8728dd246c3a
  Built:            Fri Apr  9 22:06:18 2021
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v1.4.4
  GitCommit:        05f951a3781f4f2c1911b05e61c160e9c30eaa8e
 runc:
  Version:          1.0.0-rc93
  GitCommit:        12644e614e25b05da6fd08a38ffa0cfe1903fdec
 docker-init:
  Version:          0.1.3_catatonit
  GitCommit:

The git Revision

2.1.0

The git Status

Not cloning the repository because the server not have access to internet. I download the repository and upload to the server.

Startup Command

docker compose up -d

NetBox Logs

Attaching to netbox-docker_netbox_1
netbox_1               | 🧬 loaded config '/etc/netbox/config/configuration.py'
netbox_1               | 🧬 loaded config '/etc/netbox/config/extra.py'
netbox_1               | 🧬 loaded config '/etc/netbox/config/logging.py'
netbox_1               | 🧬 loaded config '/etc/netbox/config/plugins.py'
netbox_1               | 💡 Superuser Username: admin, E-Mail: 
netbox_1               | 🧬 loaded config '/etc/netbox/config/configuration.py'
netbox_1               | 🧬 loaded config '/etc/netbox/config/extra.py'
netbox_1               | 🧬 loaded config '/etc/netbox/config/logging.py'
netbox_1               | 🧬 loaded config '/etc/netbox/config/plugins.py'
netbox_1               | ▶️  Running the startup script /opt/netbox/startup_scripts/000_users.py
netbox_1               | ▶️  Running the startup script /opt/netbox/startup_scripts/010_groups.py
netbox_1               | ▶️  Running the startup script /opt/netbox/startup_scripts/020_object_permissions.py
netbox_1               | ▶️  Running the startup script /opt/netbox/startup_scripts/030_custom_fields.py
netbox_1               | ▶️  Running the startup script /opt/netbox/startup_scripts/040_custom_links.py
netbox_1               | ▶️  Running the startup script /opt/netbox/startup_scripts/050_tags.py
netbox_1               | ▶️  Running the startup script /opt/netbox/startup_scripts/060_webhooks.py
netbox_1               | ▶️  Running the startup script /opt/netbox/startup_scripts/070_tenant_groups.py
netbox_1               | ▶️  Running the startup script /opt/netbox/startup_scripts/080_tenants.py
netbox_1               | ▶️  Running the startup script /opt/netbox/startup_scripts/090_regions.py
netbox_1               | ▶️  Running the startup script /opt/netbox/startup_scripts/110_sites.py
netbox_1               | ▶️  Running the startup script /opt/netbox/startup_scripts/120_locations.py
netbox_1               | ▶️  Running the startup script /opt/netbox/startup_scripts/130_rack_roles.py
netbox_1               | ▶️  Running the startup script /opt/netbox/startup_scripts/140_racks.py
netbox_1               | ▶️  Running the startup script /opt/netbox/startup_scripts/150_power_panels.py
netbox_1               | ▶️  Running the startup script /opt/netbox/startup_scripts/160_power_feeds.py
netbox_1               | ▶️  Running the startup script /opt/netbox/startup_scripts/170_manufacturers.py
netbox_1               | ▶️  Running the startup script /opt/netbox/startup_scripts/180_device_roles.py
netbox_1               | ▶️  Running the startup script /opt/netbox/startup_scripts/190_device_types.py
netbox_1               | ▶️  Running the startup script /opt/netbox/startup_scripts/200_devices.py
netbox_1               | ▶️  Running the startup script /opt/netbox/startup_scripts/210_dcim_interfaces.py
netbox_1               | ▶️  Running the startup script /opt/netbox/startup_scripts/220_platforms.py
netbox_1               | ▶️  Running the startup script /opt/netbox/startup_scripts/230_route_targets.py
netbox_1               | ▶️  Running the startup script /opt/netbox/startup_scripts/240_vrfs.py
netbox_1               | ▶️  Running the startup script /opt/netbox/startup_scripts/250_rirs.py
netbox_1               | ▶️  Running the startup script /opt/netbox/startup_scripts/260_asns.py
netbox_1               | ▶️  Running the startup script /opt/netbox/startup_scripts/270_aggregates.py
netbox_1               | ▶️  Running the startup script /opt/netbox/startup_scripts/280_prefix_vlan_roles.py
netbox_1               | ▶️  Running the startup script /opt/netbox/startup_scripts/290_cluster_types.py
netbox_1               | ▶️  Running the startup script /opt/netbox/startup_scripts/300_cluster_groups.py
netbox_1               | ▶️  Running the startup script /opt/netbox/startup_scripts/310_clusters.py
netbox_1               | ▶️  Running the startup script /opt/netbox/startup_scripts/320_vlan_groups.py
netbox_1               | ▶️  Running the startup script /opt/netbox/startup_scripts/330_vlans.py
netbox_1               | ▶️  Running the startup script /opt/netbox/startup_scripts/340_virtual_machines.py
netbox_1               | ▶️  Running the startup script /opt/netbox/startup_scripts/350_virtualization_interfaces.py
netbox_1               | ▶️  Running the startup script /opt/netbox/startup_scripts/360_prefixes.py
netbox_1               | ▶️  Running the startup script /opt/netbox/startup_scripts/370_ip_addresses.py
netbox_1               | ▶️  Running the startup script /opt/netbox/startup_scripts/380_primary_ips.py
netbox_1               | ▶️  Running the startup script /opt/netbox/startup_scripts/400_services.py
netbox_1               | ▶️  Running the startup script /opt/netbox/startup_scripts/420_providers.py
netbox_1               | ▶️  Running the startup script /opt/netbox/startup_scripts/440_circuit_types.py
netbox_1               | ▶️  Running the startup script /opt/netbox/startup_scripts/450_circuits.py
netbox_1               | ▶️  Running the startup script /opt/netbox/startup_scripts/460_cables.py
netbox_1               | ▶️  Running the startup script /opt/netbox/startup_scripts/470_contact_groups.py
netbox_1               | ▶️  Running the startup script /opt/netbox/startup_scripts/480_contact_roles.py
netbox_1               | ▶️  Running the startup script /opt/netbox/startup_scripts/490_contacts.py
netbox_1               | ✅ Initialisation is done.

Content of docker-compose.override.yml

version: '3.4'
services:
  reverseproxy:
    image: reverseproxy
    ports:
      - 80:80
      - 443:443
    restart: always
    volumes:
      - ./nginx/nginx.conf:/etc/nginx/nginx.conf
      - ./nginx/private/netbox.key:/etc/ssl/private/netbox.key
      - ./nginx/certs/netbox.crt:/etc/ssl/certs/netbox.crt
  netbox:
    depends_on:
      - reverseproxy
    ports:
    - 8000:8080
    restart: unless-stopped
  netbox-worker:
    restart: unless-stopped
  postgres:
    restart: unless-stopped
  redis:
    restart: unless-stopped
  redis-cache:
    restart: unless-stopped

3bruno avatar Aug 02 '22 19:08 3bruno

It would be helpful if you showed the error when trying to run that command.

/opt/netbox/venv/bin/python3 /opt/netbox/netbox/manage.py dbshell
🧬 loaded config '/etc/netbox/config/configuration.py'
🧬 loaded config '/etc/netbox/config/logging.py'
🧬 loaded config '/etc/netbox/config/plugins.py'
CommandError: You appear not to have the 'psql' program installed or on your path.

ryanmerolle avatar Aug 03 '22 14:08 ryanmerolle

Added a section to the wiki to explain direct access to the database and a Troubleshooting entry for dbshell.

tobiasge avatar Aug 31 '22 11:08 tobiasge