Essential GitHub Enterprise Admin Commands
GitHub Enterprise Server (GHES) administrators can ensure their environments remain robust, secure, and responsive to organizational needs.
Join the DZone community and get the full member experience.
Join For FreeManaging a GitHub Enterprise Server (GHES) efficiently requires familiarity with its command-line utilities. These tools allow administrators to perform a range of critical tasks, from managing users and repositories to optimizing system performance and ensuring security compliance.
We'll explore the top ten essential commands that are frequently used by GHES admins:
1. ghe-maintenance
E.g., ghe-maintenance -s
ghe-maintenance -h
Usage: ghe-maintenance [-hqseu]
Set or unset the maintenance mode on GitHub Enterprise Server
OPTIONS:
-h | --help Show this message
-q | --query Query current mode
-s | --set Set the maintenance mode
-e | --enable-ip-exception Unset the maintenance mode but make GHES only accessible by IP exception list provided as an argument
<list of IPv4/IPv6 addresses or CIDR blocks>
-u | --unset Unset the maintenance mode
-m | --message Set a custom message that will be shown whenever maintenance mode is set.
The ghe-maintenance
command is used in GitHub Enterprise Server to enable or disable maintenance mode on the server. Maintenance mode is a feature that allows administrators to perform system updates, backups, or other administrative tasks while preventing users from making changes or accessing certain features. When maintenance mode is active, users cannot push to repositories, create issues, or perform other write operations.
2. ghe-service-list
$ ghe-service-list
active
- actions
- alambic
- alive
- aqueduct-lite
- artifactcache
- authnd
- authzd
- babeld
- codeload
- consul, process 16975
- consul-template
- dependabot-api
- dependabot-aqueduct-worker
- dependabot-env
- dependabot-hydro-consumer
- dependabot-timerd
- dependency-graph-api-aqueduct-worker
- dependency-graph-api-env
- dependency-graph-api-processor-manifest-file-changed-worker
- dependency-graph-api-processor-manifest-file-deleted-worker
- dependency-graph-api-service
- dependency-snapshots-api-env
- dependency-snapshots-api-service
- driftwood
- elasticsearch
- enterprise-manage-unicorn, process 6936
- ghe-user-disk, process 4517
- git-daemon
- github-env
- github-ernicorn
- github-gitauth
- github-resqued
- github-stream-processors
- github-timerd
- github-unicorn
- gitrpcd
- governor
- gpgverify
- grafana
- graphite-web
- haproxy-cluster-proxy
- haproxy-data-proxy
- haproxy-frontend
- hookshot-go
- http2hydro
- kafka-lite
- kredz
- kredz-hydro-consumer
- kredz-varz
- launch-deployer
- launch-hydro-consumer
- launch-receiver
- launch-worker
- lfs-server
- mail-replies
- memcached
- minio
- mps
- mssql
- mysql
- nginx
- nomad, process 3582931
- notebooks
- pages
- pages-deployer-api
- pages-deployer-worker
- postfix
- redis
- spokesctl
- spokesd
- spokes-sweeper
- token
- token-scanning-api
- token-scanning-backfill-worker
- token-scanning-content-backfill-worker
- token-scanning-content-scan-worker
- token-scanning-hcs-upgrade-backfill-worker
- token-scanning-hydro-consumer
- token-scanning-incremental-worker
- token-scanning-jobgroup-worker
- token-scanning-partner-validity-check-worker
- token-scanning-reposync-worker
- token-scanning-scans-api
- token-scanning-udp-backfill-worker
- treelights
- turboghas
- turboscan
- viewscreen
- wireguard, process 19265
The ghe-service-list
command is a GitHub Enterprise Server administrative utility that provides a list of services running on the GHE instance. This command is particularly useful for monitoring, troubleshooting, and managing the services that keep the GitHub Enterprise Server operational.
3. ghe-repl-status
ghe-repl-status
Verifying ssh connectivity with primary ...
OK: mysql replication is in sync
OK: mssql replication is in sync
OK: redis replication is in sync
OK: elasticsearch cluster is in sync (0 shards initializing, 0 shards unassigned)
OK: git replication is in sync
OK: pages replication is in sync
OK: alambic replication is in sync
OK: git-hooks replication is in sync
OK: consul replication is in sync
The ghe-repl-status
command in GitHub Enterprise Server is used to check the status of replication between the primary and replica nodes in a GHE cluster. Replication is essential in a multi-node GHE setup to ensure that data is synchronized between nodes, enabling high availability or cache replications for read only. This command can only be run on a replica.
4. ghe-repl-promote
$ ghe-repl-promote
Warning: You are about to promote this Replica node
Promoting this Replica will tear down replication and enable maintenance mode on the current Primary.
All other Replicas need to be re-setup to use this new Primary server.
Proceed with promoting this appliance to Primary? [y/N] y
Enabling maintenance mode on the primary to prevent writes ...
Stopping replication ...
| Stopping Pages replication ...
| Stopping Git replication ...
| Stopping Alambic replication ...
| Stopping git-hooks replication ...
| Stopping MySQL replication ...
| Stopping Redis replication ...
| Stopping Consul replication ...
| Success: Replication was stopped for all services.
| To disable replica mode and remove all replica configuration, run 'ghe-repl-teardown'.
Switching out of replica mode ...
| Validating configuration
| Updating configuration
| Configuration Updated
| Validating configuration
The ghe-repl-promote
command in GitHub Enterprise Server is used to promote a replica node to become the primary node in a high-availability setup. This command is critical during disaster recovery or planned failover scenarios when the primary node is no longer operational, and a replica needs to take over as the active primary.
5. ghe-spokesclt
$ ghe-spokesctl
ghe-spokesctl is a CLI interface for interacting with spokes
Usage:
ghe-spokesctl [command]
Available Commands:
bless Choose the correct repository checksum based on the replica(s)
cache-policy Manage caching policy
certificates TLS certificate management
check Reports on the status of the spokes known entity
check-network-replicas Validates and repairs networked repositories with broken membership
check-weights Check the read-weights for abnormal values
completion Generate the autocompletion script for the specified shell
find-on-replicas Finds networks and gists sharing the same replica servers
git-config Get or set config values for a repository or repository network
gov Query or manage Governor
help Help about any command
info Print data about an nwo
list-replication Export replication status on repository entities
purge Removes the specified entity from spokes
purge-network-replica Removes the specified empty network replica from spokes
purge-replica Removes the specified replica from spokes
rebalance Manage fileserver capacity rebalancing
recompute-checksums Recompute checksums for a given repository or gist
repair-checksums Attempt to repair checksums on other replicas from the provided target replica
replica Replica management (create/move/delete/activate/fail)
repositories Print all repositories which belong to the given network
resolve Resolve a repository to its spec, nwo, or shard path.
restore-objects Find and restore corrupted or missing objects in a repository replica
routes Show the routes for a given nwo or repository spec
server fileserver management
ssh SSH to a repository and optionally run a command
status Displays a summary of the status of all repositories and gists
version Print the version number of ghe-spokesctl
Flags:
-h, --help help for ghe-spokesctl
--log-level string log level <debug|info|error|none> (default "error")
-v, --verbose verbose output
Use "ghe-spokesctl [command] --help" for more information about a command.
ghe-spokesclt
is a command-line tool used in the context of GitHub Enterprise Server. It is primarily designed to interact with and manage GitHub Spokes, a feature of GitHub Enterprise Server that facilitates efficient replication
6. ghe-user-promote
$ ghe-user-demote abc
User abc is not a site admin.
$ ghe-user-promote abc
User abc is a site admin.
The ghe-user-promote
command is used in GitHub Enterprise Server to grant site administrator privileges to a user account. This is an important administrative tool for managing roles and permissions in a GitHub Enterprise environment. The ghe-user-promote
command in GHE is used to promote a regular user account to a site administrator. Site administrators have elevated privileges, enabling them to manage the entire GHE instance, including repository settings, user management, and server configuration.
7. ghe-actions-check
MSSQL is healthy!
Mps database is healthy!
Mps nomad job is healthy!
Mps AT health api is healthy!
Token database is healthy!
Token nomad job is healthy!
Token AT health api is healthy!
Actions database is healthy!
Actions nomad job is healthy!
Actions AT health api is healthy!
Artifactcache database is healthy!
Artifactcache nomad job is healthy!
Artifactcache AT health api is healthy!
The ghe-actions-check
command is used in GitHub Enterprise Server to monitor and troubleshoot the GitHub Actions service. GitHub Actions is an automation platform that allows users to build, test, and deploy their code directly from their GitHub repositories.
8. ghe-motd
INFO: Release version: 3.13.5
INFO: 240 CPUs, 1511GB RAM on KVM
INFO: License: production; Seats: 840 of 8205; Will expire in 1000 days.
INFO: Load average: 12.63 12.27 13.71
INFO: Usage for mounted root partition: 105G of 196G (57%)
INFO: Usage for mounted user data partition: 381G of 4.9T (9%)
INFO: TLS: enabled; Certificate will expire in 1000 days.
INFO: HA: primary
INFO: Configuration run in progress: false
Theghe-motd
utility re-displays the message of the day (MOTD) that administrators see when accessing the instance via the administrative shell. The output contains an overview of the instance's state.
8. ghe-announce
Usage: ghe-announce [options]
Get, set or clear a global announcement banner, to be displayed to all users.
OPTIONS:
-h, --help Show this message.
-s MESSAGE, --set=MESSAGE Set a global announcement banner.
-e DATE, --expires=DATE Only valid when the -s option is provided. Sets
the date when the announcement should expire.
DATE must be provided in the YYYY-MM-DD format.
-d, --dismissible Make the global announcement banner dismissible to each user.
-g, --get Get the global announcement banner.
-u, --unset Unset the global announcement banner.
The ghe-announce
command is used in GitHub Enterprise Server (GHE) to send broadcast messages to all active users in the system. Unlike the ghe-motd
, which displays a persistent message, ghe-announce
delivers an immediate and transient notification to users who are currently active on the system.
10. ghe-dbconsole
$ ghe-dbconsole
ghe-dbconsole should only be used when requested by the GitHub Enterprise Support team. Incorrect use could cause damage or data loss.
Proceed with ghe-dbconsole? [y/N] y
mysql: [Warning] Using a password on the command line interface can be insecure.
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1338885
Server version: 8.0.28 MySQL Community Server - GPL
Copyright (c) 2000, 2024, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
mysql>
mysql>
Theghe-dbconsole
utility opens a MySQL database session on your GitHub Enterprise appliance.
Conclusion
In conclusion, mastering these essential GitHub Enterprise Server (GHES) commands empowers administrators to effectively manage and maintain their systems. From toggling maintenance modes with ghe-maintenance
to monitoring replication with ghe-repl-status
or promoting replica through ghe-repl-promote
, each command serves a critical purpose in optimizing server performance, enhancing security, and minimizing downtime.
Whether it’s managing user privileges with ghe-user-promote
, broadcasting system-wide announcements using ghe-announce
, or troubleshooting GitHub Actions with ghe-actions-check
, these tools provide the flexibility and control needed for seamless administration. Commands like ghe-motd
offer quick insights into server health, while advanced tools like ghe-spokesctl
and ghe-dbconsole
allow deeper interaction and configuration of the system.
By leveraging these commands, GHES administrators can ensure their environments remain robust, secure, and responsive to organizational needs. Regular practice and adherence to best practices will not only simplify operational tasks but also contribute to the overall reliability and efficiency of the GitHub Enterprise Server setup.
Opinions expressed by DZone contributors are their own.
Comments