Galaxy Server
To be able to host your own custom collections and not depend on your internet connection being always on,
you will need to install a private galaxy server, like AAP does this.
We used the upstream project of the galaxy server for this:
Beware, the code in the blog describes the installation and configuration of the community install, this is not what we need, we installed and configured the standalone edition.
Preinstall Galaxy NG (Standalone Automation Hub) Backend
Galaxy NG is the open-source upstream of Red Hat's Automation Hub. It provides a Galaxy-compatible API and web interface for collections, with legacy role support handled through the v1 API.
Deploying Galaxy NG with Docker Compose The quickest way to get started for local evaluation is with the official Galaxy NG compose stack from the source repository:
- install git
- Get the Galaxy NG source
dnf install git -y
git clone https://github.com/ansible/galaxy_ng.git
cd galaxy_ng
- Set some things right
- Edit the following file:
vi dev/compose/standalone.yaml
- Change or add the following lines:
- Add your servers fqdn into the trusted origins
- Add overrule for port 80 in nginx config
PULP_CORS_ALLOW_ALL_ORIGINS: 'true'
PULP_CSRF_TRUSTED_ORIGINS: "['http://localhost','http://<your-server-fqdn>','https://<your-server-fqdn>']"
nginx:
build:
context: .
dockerfile: Dockerfile.nginx
additional_contexts:
base_img: service:base_img
depends_on:
base_img:
condition: service_completed_successfully
postgres:
condition: service_healthy
migrations:
condition: service_completed_successfully
api:
condition: service_healthy
content:
condition: service_healthy
ports:
- '5001:5001'
- '8080:80'
volumes:
- '../nginx/nginx.conf:/etc/nginx/nginx.conf:ro,Z'
Build and start Automation HUB backend
Now we have configured the files and options we need to run the Hub, we can start the build of the containers.
docker compose -f dev/compose/standalone.yaml build
docker compose -f dev/compose/standalone.yaml up -d
# Wait for services to be healthy
docker compose -f dev/compose/standalone.yaml ps
In the configuration is the creation of a default admin user defined, you can create additional users if you want, using the following command:
docker compose -f dev/compose/standalone.yaml exec manager pulpcore-manager createsuperuser \
--username <admin_username> \
--email <admin_email> \
You will be prompted to enter the password.
The backend should be runnning now.
Once running, the Galaxy API is available at -- http://localhost:5001/api/galaxy/v3/swagger-ui/.
The standalone community UI can be run separately from the ansible-hub-ui repository and is available at -- http://localhost:8002 when started. From there you can:
Create namespaces for different teams Set up approval workflows for new content Configure remote repositories to sync from public Galaxy NOTE This only works from localhost!
Frontend
To have a fully functional automation hub, we need a frontend that is useable from any host in our (internal) network.
The UI can run either as part of the backend container, or locally. The development version of the frontend uses webpack dev server.
Before we can configure and build the forntend UI, we must install some tools:
Install nodejs:
dnf module list nodejs
dnf module install nodejs:24
node -v
Now we can clone and build the UI:
git clone https://github.com/ansible/ansible-hub-ui
cd ansible-hub-ui
npm install
To run the UI:
cd ansible-hub-ui
API_PROXY=http://localhost:5001 npm run start-standalone
We can now go to the host using http://<fqdn>:8002 and you will see the login screen.
Add an nginx proxy with certbot to secure your UI...
To create a nice and shiny webservice that is secure, follow these steps:
dnf install nginx -y
If you have a local acme server in your network, install and use certbot:
dnf install epel-release -y
dnf install certbot python3-certbot-nginx -y
cd /etc/pki/ca-trust/source/anchors
curl -OLk https://acme.homelab:9000/roots.pem
update-ca-trust
Add firewall ports for the service:
firewall-cmd --zone=public --add-port=80/tcp
firewall-cmd --permanent --zone=public --add-port=80/tcp
firewall-cmd --zone=public --add-port=443/tcp
firewall-cmd --permanent --zone=public --add-port=443/tcp
firewall-cmd --zone=public --add-port=8002/tcp
firewall-cmd --permanent --zone=public --add-port=8002/tcp
firewall-cmd --zone=public --add-port=5001/tcp
firewall-cmd --permanent --zone=public --add-port=5001/tcp
Configure nginx
If you use certbot: vi /etc/nginx/conf.d/server-fqdn.conf
server {
listen 80;
server_name server-fqdn;
# Proxy to Galaxy API
location /api/ {
proxy_pass http://127.0.0.1:5001;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
# Galaxy NG UI, if running the standalone UI
location / {
proxy_pass http://127.0.0.1:8002;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
Let certbot get the certificate and apply:
certbot --nginx --server https://
If you don't use certbot, insert you certificates into the configuration file and configure ssl by hand.
make the ui autostarting:
create a small script to start the UI, start-ui.sh:
#!/bin/bash
cd /root/ansible-hub-ui
API_PROXY=http://localhost:5001 npm run start-standalone
Make the script executable.
Add this entry to the crontab of the root user:
chmod +x /root/ansible-hub-ui/start-ui.sh
@reboot: /root/ansible-hub-ui/start-ui.sh
Your galaxy service should be up-and-running and ready to login.