Sign inSign up

dshap/nexus

By dshap

Updated 10 days ago

Nexus web server

Image
Web servers
Content management system
0

125

dshap/nexus repository overview

Nexus web server

Docker image for nexus web server.

Container runs as non-root user. This user owns nexus process and owns nexus files.

To run container next volumes should be mapped:

  • folder for nexus database
  • folder for nexus files
  • logs folder
  • backups folder

Installation

Installation from docker image
  1. Pull docker image
  2. Create user and group to own nexus files and to run docker container:
    sudo groupadd -g 1193 nexus
    
    useradd -u 1193 -g 1193 -M nexus
    
  3. Proceed to configuration
Installation from source
  1. Pull project sources from version control system
  2. Create user and group to own nexus files and to run docker container:
    sudo useradd -r nexus
    
    sudo groupmod -g 1193 nexus
    
    sudo usermod -u 1193 nexus
    
  3. Make build executable:
    sudo chmod u+x ./build
    
  4. Execute build:
    sudo ./build nexus
    
  5. Proceed to configuration
Configuration
  1. Obtain configuration files and scripts from the container:
    cd ~
    
    mkdir conf
    
    sudo chown nexus:nexus ~/conf
    
    sudo docker run \
        --rm \
        -v ~/conf:/export \
        dshap/nexus:3.95.3 export-assets
    
  2. Create folders for nexus files:
    sudo mkdir /nexus
    
    sudo mkdir /nexus/blobs
    
    sudo mkdir /nexus/db
    
    sudo mkdir /nexus/etc
    
    sudo mkdir /nexus/keystores
    
    sudo chown -R nexus:nexus /nexus
    
  3. Create a folder for logs:
    sudo mkdir /var/log/nexus
    
    sudo chown -R nexus:nexus /var/log/nexus
    
  4. Create a folder for backups:
    sudo mkdir /var/backups/nexus
    
    sudo chown -R nexus:nexus /var/backups/nexus
    
  5. Copy service configuration file:
    sudo cp ~/conf/etc/init.d/nexus /etc/init.d
    
    sudo chmod a+x /etc/init.d/nexus
    
  6. Copy docker run script:
    sudo cp ~/conf/usr/sbin/nexus /usr/sbin
    
    sudo chmod a+x /usr/sbin/nexus
    
  7. Copy util script:
    sudo cp ~/conf/usr/bin/nutil /usr/bin
    
    sudo chmod a+x /usr/bin/nutil
    
  8. Remove temporary config folder:
    sudo rm -rf ~/conf
    
  9. Register service:
    sudo update-rc.d nexus defaults
    
  10. Start nexus service:
    sudo service nexus start
    
  11. Get temporary admin password:
    sudo nutil admin-password
    
  12. Login to nexus with temporary admin password and initialize nexus
  13. Restart nexus service:
    sudo service nexus restart
    

Management

Service management
sudo service nexus (start|stop|status|restart)
Create backup
sudo nutil backup <filename>

Backup file /var/backups/nexus/<filename>.tar.gz will be created.

Restore backup
sudo nutil restore <filename>
Command line (bash)
sudo nutil bash

Apache mod_proxy configuration

Nexus web server can be located with another web applications. For example, mercurial, bugzilla, wiki etc can be run as docker containers on the same host. In this case apache server can be used to redirect requests to different docker containers.

  1. Enable apache mod_proxy:
    sudo a2enmod deflate headers proxy proxy_ajp proxy_balancer proxy_connect proxy_html proxy_http rewrite
    
  2. Configure proxy:
    <VirtualHost *:80>
        ...
        ProxyPreserveHost On
        <Proxy *>
            Order allow,deny
            Allow from all
        </Proxy>
        ...
    </VirtualHost>
    
  3. Copy site configuration file:
    sudo cp ~/conf/etc/apache2/sites-available/nexus.conf /etc/apache2/sites-available
    
  4. Enable apache sites:
    sudo a2ensite nexus
    
  5. Restart apache service:
    sudo service apache2 restart
    

HOW TO

How to create cron job for backups
sudo crontab -l | { cat; echo "minute hour * * * /usr/bin/nutil backup <filename>"; echo ""; } | sudo crontab -

Tag summary

Content type

Image

Digest

sha256:b5ea5ef12

Size

1.3 GB

Last updated

10 days ago

docker pull dshap/nexus:3.95.3