Rails DCIM Portal is an early development Ruby on Rails implementation of a data center inventory management system that integrates with Foreman.
This app is meant to integrate with other software. The software may be run all on one machine/container, split into different machines/containers, or combined in any way among these categories:
- App server – Runs this app, which interfaces with Foreman for inventory and Foreman's Smart Proxies for inventory that has not yet been added to Foreman
- Foreman server – Runs Foreman, which is the single source of truth for inventory information and operations
- Smart Proxy server(s) – Runs Smart Proxy, which allows the app and Foreman to communicate with your infrastructure
Before installing, these prerequisites need to be satisfied:
- Git (>= 1.6.6) – Downloads the latest build of this app
- Suggested installation: Install the
git
package using your operating system's package manager or download and install Git manually if your operating system does not have a package manager.
- Suggested installation: Install the
- Foreman (>= 1.12) – This app synchronizes data with Foreman, which is the source of truth.
- Suggested installation: Use the interactive Foreman installer,
foreman-installer -i
as documented in the Foreman manual.
- Suggested installation: Use the interactive Foreman installer,
- Foreman - Discovery (>= 6.0.0) – Handles discovered hosts in Foreman when this app onboards them
- Suggested installation: Use the interactive Foreman installer,
foreman-installer -i
, and enableforeman_plugin_discovery
.
- Suggested installation: Use the interactive Foreman installer,
- Smart Proxy (>= 1.16) – This app uses Smart Proxy to control data center inventory that is accessible to the Smart Proxy.
- Suggested installation: Use the interactive Foreman installer,
foreman-installer -i
, and enableforeman_proxy
with these options set to true:ssl
,templates
,tftp
,dhcp
,bmc
- This app needs a client certificate authorized by all Smart Proxies intended to be used.
- The certificate chains for the app and the Smart Proxies need to be signed by the same certificate authority.
- The app's client certificate hostname needs to be added to
:trusted_hosts
in each Smart Proxy's/etc/foreman-proxy/settings.yml
.
- Suggested installation: Use the interactive Foreman installer,
- IPMItool (>= 1.8) – For interacting with IPMI BMC hosts, this app needs IPMItool because IPMItool is more reliable at some operations, like manipulating chassis power, than FreeIPMI.
- Suggested installation: Install the
ipmitool
package using your operating system's package manager or download and install IPMItool manually if your operating system does not have a package manager.
- Suggested installation: Install the
- FreeIPMI (>= 1.4) – For interacting with IPMI BMC hosts, this app needs FreeIPMI because FreeIPMI is more reliable at some operations, like returning useful error messages and obtaining FRU lists, than IPMItool.
- Suggested installation: Install the
freeipmi
package using your operating system's package manager or download and install FreeIPMI manually if your operating system does not have a package manager.
- Suggested installation: Install the
- Smart Proxy - Discovery (>= 1.0.3) – Enables communication between Foreman and discovered hosts accessible to each Smart Proxy
- Suggested installation: Use the interactive Foreman installer,
foreman-installer -i
, and enableforeman_proxy_plugin_discovery
.
- Suggested installation: Use the interactive Foreman installer,
- Smart Proxy - Onboard (>= 0.2.0) – Extended functionality for Smart Proxy needed by this app
- Suggested installation: Follow the instructions here.
In addition to the base prerequisites, these additional prerequisites need to be satisfied for Docker deployments on the app server:
- Docker Engine (>= 1.10) – Runs the containerized version of this app
- Docker Compose (>= 1.10) – Constructs and starts up the containers for this app
In addition to the base prerequisites, these additional prerequisites need to be satisfied for manual deployments on the app server:
- Ruby (>= 2.2.5) – This app is written in Ruby.
-
Suggested installation: Latest stable version of Ruby with rbenv and ruby-build:
rbenv install "$(rbenv install -l | grep -v - | tail -1 | xargs)"
-
- Bundler (>= 1.6.0) – Easily installs and updates the dependencies for this app
- Suggested installation:
gem install bundler
- Suggested installation:
- MariaDB Server (>= 5.6.4) or any MySQL-compatible server
- Suggested installation: You may use the same MySQL backend as Foreman. If you don't want to do this, install the
mariadb-server
package using your operating system's package manager, or download and install MariaDB Server manually if your operating system does not have a package manager. Alternatively, you may use MySQL server clustering software like Percona XtraDB Cluster.
- Suggested installation: You may use the same MySQL backend as Foreman. If you don't want to do this, install the
- MySQL development headers (>= 5.6.4) – For the
mysql2
gem- Suggested installation for Ubuntu/Debian:
apt install -y libmysqlclient-dev
- Suggested installation for RHEL/CentOS:
yum install -y mysql-devel
- Suggested installation for Ubuntu/Debian:
- Redis (>= 2.8) – Sidekiq job queuing and Action Cable WebSockets updates
- Suggested installation: Follow the Redis Quick Start to install an up-to-date version of Redis or install
redis-server
andredis-tools
on Debian/Ubuntu or installredis
on Fedora/EPEL.
- Suggested installation: Follow the Redis Quick Start to install an up-to-date version of Redis or install
Rails DCIM Portal can be deployed fairly easily with Docker. The Docker Compose file includes the MySQL database, Redis, Sidekiq, and the app.
- Change your working directory (using
cd
) to where you want to deploy the app. git clone https://github.com/buddwm/Rails_DCIM_Portal.git
cd Rails_DCIM_Portal
- Build the app with
docker-compose build
. - Start the app with
docker-compose up
. Optionally add the-d
flag to run the app as a daemon. - You can now access the app over HTTP at the server's IP address, port 3000. If you're running this on your local machine, go to http://localhost:3000 in your web browser.
Note that Foreman and the other prerequisites are not provided here; they must be deployed separately.
- Change your working directory (using
cd
) to where you want to deploy the app. git clone https://github.com/buddwm/Rails_DCIM_Portal.git
cd Rails_DCIM_Portal
- Install the gem dependencies with
bundle install
. - Ensure that MariaDB is running at
ENV['DCIM_PORTAL_DB_HOST']
on portENV['DCIM_PORTAL_DB_PORT']
with usernameENV['DCIM_PORTAL_DB_USERNAME']
identified by passwordENV['DCIM_PORTAL_DB_PASSWORD']
granted all privileges on databaseENV['DCIM_PORTAL_DB_DEV']
. - Ensure that Foreman is running at
ENV['FOREMAN_URL']
and can authenticate the admin userENV['FOREMAN_USERNAME']
with passwordENV['FOREMAN_PASSWORD']
. - If you have not already done so, generate a PEM certificate located at
ENV['SP_CERT']
with private key atENV['SP_PRIVKEY']
for the app, which will be used to validate the client to each Smart Proxy. The CA certificate should be copied toENV['SP_CA_CERT']
.- Suggested installation:
- Run
puppet agent --test --waitforcert 60 --server FOREMAN_HOSTNAME
, whereFOREMAN_HOSTNAME
is the hostname of your Foreman/Smart Proxy Puppet CA. - On the Puppet CA, sign the new request with
puppet cert sign
followed by the app's hostname. - In the app's host, the environment variables can then be set as follows:
SP_CA_CERT
to/var/lib/puppet/ssl/certs/ca.pem
,SP_CERT
to/var/lib/puppet/ssl/certs/APP_HOSTNAME.pem
, whereAPP_HOSTNAME
is the hostname of the app.SP_PRIVKEY
can be set to/var/lib/puppet/ssl/private_keys/APP_HOSTNAME.pem
if the app's user belongs to the grouppuppet
.
- Run
- Suggested installation:
- If you have not already done so, add the app's hostname to
:trusted_hosts
in the file/etc/foreman-proxy/settings.yml
of every Smart Proxy with which the app is expected to interact.
Before starting the app, take note of the currently customizable environment variables:
Variable | Purpose |
---|---|
DCIM_PORTAL_DB_HOST |
The MariaDB hostname to use. Specify localhost if you want to connect to the socket /var/run/mysqld/mysqld.sock . Defaults to 127.0.0.1 |
DCIM_PORTAL_DB_USERNAME |
The MariaDB username to use. Defaults to root |
DCIM_PORTAL_DB_PASSWORD |
The MariaDB password to use. Defaults to sharepoint |
DCIM_PORTAL_DB_PORT |
The MariaDB port to use. Defaults to 3306 |
DCIM_PORTAL_DB |
The catch-all MariaDB database name. Undefined by default |
DCIM_PORTAL_DB_DEV |
The development database name. Defaults to dcim_portal_development but the default is overridden by ENV['DCIM_PORTAL_DB'] |
DCIM_PORTAL_DB_TEST |
The test database name. Defaults to dcim_portal_test but the default is overridden by ENV['DCIM_PORTAL_DB'] |
DCIM_PORTAL_DB_PROD |
The production database name. Defaults to dcim_portal_production but the default is overridden by ENV['DCIM_PORTAL_DB'] |
DCIM_PORTAL_DB_POOL_SIZE |
The size of the database connection pool. Defaults to ENV['RAILS_MAX_THREADS'] or 5 , whichever is defined first |
DCIM_PORTAL_REDIS_HOST |
The Redis hostname to use for Sidekiq and Action Cable. Redis Sentinels are not supported at this time. Defaults to localhost |
DCIM_PORTAL_REDIS_PORT |
The Redis port to use for Sidekiq and Action Cable. Defaults to 6379 |
DCIM_PORTAL_REDIS_DATABASE_FOR_SIDEKIQ |
The Redis database name for Sidekiq. Defaults to 1 |
DCIM_PORTAL_REDIS_DATABASE_FOR_CABLE |
The Redis database name for Action Cable. Defaults to 2 |
FOREMAN_URL |
The Foreman URL to which the app will connect for Foreman API service |
FOREMAN_USERNAME |
The Foreman admin username. Defaults to admin |
FOREMAN_PASSWORD |
The Foreman admin password |
SP_CA_CERT |
The absolute path to the Smart Proxy client certificate authority certificate. Must be the same as all Smart Proxies accessed by this app, meaning the same certificate authority needs to sign the Smart Proxies' certificates as well as the app's client certificate |
SP_CERT |
The absolute path to the client PEM-encoded certificate, signed by the same CA as the Smart Proxies' CA |
SP_PRIVKEY |
The absolute path to the client PEM-encoded private key |
In a separate session or service, up Sidekiq, the background jobs manager:
bundle exec sidekiq
If this is your first run or you have upgraded the app, set up the database tables:
rails db:migrate RAILS_ENV=development
Start the app and listen on port 3000:
bundle exec rails s -p 3000 -b '0.0.0.0'
You can now access the app over HTTP at the server's IP address, port 3000. If you're running this on your local machine, go to http://localhost:3000 in your web browser.
Because this app is in early development, features are being filled in as fast as development is taking place. Refer to the releases page for highlights on implemented features.
As development stabilizes, this section may be updated to contain a feature overview.