Ruby

How to install ruby & rubygems in Alpine Linux

Problem:

You want to install ruby and the gem package manager in Alpine linux, but running apk install ruby rubygems shows you that the package doesn’t exist

/ # apk add ruby rubygems
ERROR: unable to select packages:
  rubygems (no such package):
    required by: world[rubygems]

Solution:

gem is included in the ruby package. So the only command you need to run is

apk update
apk add ruby

Example output:

/ # apk add ruby
(1/7) Installing ca-certificates (20191127-r5)
(2/7) Installing gdbm (1.19-r0)
(3/7) Installing gmp (6.2.1-r0)
(4/7) Installing readline (8.1.0-r0)
(5/7) Installing yaml (0.2.5-r0)
(6/7) Installing ruby-libs (2.7.3-r0)
(7/7) Installing ruby (2.7.3-r0)
Executing busybox-1.32.1-r6.trigger
Executing ca-certificates-20191127-r5.trigger
OK: 928 MiB in 154 packages

After doing that, you can immediately use both ruby and gem.

Posted by Uli Köhler in Alpine Linux, Container, Docker, Linux, Ruby

How to list gitlab-rake tasks

You can list the tasks available in your GitLab’s gitlab-rake using

gitlab-rake -T

In case you’re running a docker-compose based configuration, you can use

docker-compose exec gitlab gitlab-rake -T

where gitlab is the name of the docker-compose service in docker-compose.yml.

This will show you a list like

rake about                                                      # List versions of all Rails frameworks and the environment
rake acts_as_taggable_on_engine:install:migrations              # Copy migrations from acts_as_taggable_on_engine to app...
rake acts_as_taggable_on_engine:tag_names:collate_bin           # Forcing collate of tag names to utf8_bin
rake acts_as_taggable_on_engine:tag_names:collate_ci            # Forcing collate of tag names to utf8_general_ci
rake app:template                                               # Applies the template supplied by LOCATION=(/path/to/te...
rake app:update                                                 # Update configs and some other initially generated file...
rake assets:clean[keep]                                         # Remove old compiled assets
rake assets:clobber                                             # Remove compiled assets
rake assets:environment                                         # Load asset compile environment
rake assets:precompile                                          # Compile all the assets named in config.assets.precompile
rake brakeman                                                   # Security check via brakeman
rake cache:clear:redis                                          # GitLab | Cache | Clear redis cache
rake cache_digests:dependencies                                 # Lookup first-level dependencies for TEMPLATE (like mes...
rake cache_digests:nested_dependencies                          # Lookup nested dependencies for TEMPLATE (like messages...
rake ci:cleanup:builds                                          # GitLab | CI | Clean running builds
rake clean                                                      # Remove any temporary products
rake clobber                                                    # Remove any generated files
rake config_lint                                                # Checks syntax for shell scripts and nginx config files...
rake danger_local                                               # Run local Danger rules
rake db:create                                                  # Creates the database from DATABASE_URL or config/datab...
rake db:drop                                                    # Drops the database from DATABASE_URL or config/databas...
rake db:environment:set                                         # Set the environment value for the database
rake db:fixtures:load                                           # Loads fixtures into the current environment's database
rake db:migrate                                                 # Migrate the database (options: VERSION=x, VERBOSE=fals...
rake db:migrate:status                                          # Display status of migrations
rake db:obsolete_ignored_columns                                # Show a list of obsolete `ignored_columns`
rake db:prepare                                                 # Runs setup if database does not exist, or runs migrati...
rake db:rollback                                                # Rolls the schema back to the previous version (specify...
rake db:schema:cache:clear                                      # Clears a db/schema_cache.yml file
rake db:schema:cache:dump                                       # Creates a db/schema_cache.yml file
rake db:schema:dump                                             # Creates a db/schema.rb file that is portable against a...
rake db:schema:load                                             # Loads a schema.rb file into the database
rake db:seed                                                    # Loads the seed data from db/seeds.rb
rake db:seed:replant                                            # Truncates tables of each database for current environm...
rake db:seed_fu                                                 # Loads seed data for the current environment
rake db:setup                                                   # Creates the database, loads the schema, and initialize...
rake db:structure:dump                                          # Dumps the database structure to db/structure.sql
rake db:structure:load                                          # Recreates the databases from the structure.sql file
rake db:version                                                 # Retrieves the current schema version number
rake dev:load                                                   # GitLab | Dev | Eager load application
rake dev:setup                                                  # GitLab | Dev | Setup developer environment (db, fixtures)
rake downtime_check                                             # Checks if migrations in a branch require downtime
rake file_hooks:validate                                        # Validate existing file hooks
rake gemojione:aliases                                          # Generates Emoji SHA256 digests
rake gemojione:install_assets                                   # Install Emoji Image Assets
rake gettext:add_language[language]                             # add a new language
rake gettext:find                                               # Update pot/po files
rake gettext:lint                                               # Lint all po files in `locale/
rake gettext:pack                                               # Create mo-files
rake gettext:po_to_json                                         # Convert PO files to JS files
rake gettext:regenerate                                         # Regenerate gitlab.pot file
rake gettext:store_model_attributes                             # write the model attributes to <locale_path>/model_attr...
rake gitlab:app:check                                           # GitLab | App | Check the configuration of the GitLab R...
rake gitlab:artifacts:check                                     # GitLab | Artifacts | Check integrity of uploaded job a...
rake gitlab:artifacts:migrate                                   # GitLab | Artifacts | Migrate files for artifacts to co...
rake gitlab:assets:check_page_bundle_mixins_css_for_sideeffects # GitLab | Assets | Check that scss mixins do not introd...
rake gitlab:assets:clean                                        # GitLab | Assets | Clean up old compiled frontend assets
rake gitlab:assets:compile                                      # GitLab | Assets | Compile all frontend assets
rake gitlab:assets:compile_webpack_if_needed                    # GitLab | Assets | Compile all Webpack assets
rake gitlab:assets:fix_urls                                     # GitLab | Assets | Fix all absolute url references in CSS
rake gitlab:assets:purge                                        # GitLab | Assets | Remove all compiled frontend assets
rake gitlab:assets:purge_modules                                # GitLab | Assets | Uninstall frontend dependencies
rake gitlab:assets:vendor                                       # GitLab | Assets | Compile vendor assets
rake gitlab:backup:create                                       # GitLab | Backup | Create a backup of the GitLab system
rake gitlab:backup:restore                                      # GitLab | Backup | Restore a previously created backup
rake gitlab:check                                               # GitLab | Check the configuration of GitLab and its env...
rake gitlab:cleanup:block_removed_ldap_users                    # GitLab | Cleanup | Block users that have been removed ...
rake gitlab:cleanup:moved                                       # GitLab | Cleanup | Delete moved repositories
rake gitlab:cleanup:orphan_job_artifact_files                   # GitLab | Cleanup | Clean orphan job artifact files
rake gitlab:cleanup:orphan_lfs_file_references                  # GitLab | Cleanup | Clean orphan LFS file references
rake gitlab:cleanup:orphan_lfs_files                            # GitLab | Cleanup | Clean orphan LFS files
rake gitlab:cleanup:project_uploads                             # GitLab | Cleanup | Clean orphaned project uploads
rake gitlab:cleanup:remote_upload_files                         # GitLab | Cleanup | Clean orphan remote upload files th...
rake gitlab:cleanup:sessions:active_sessions_lookup_keys        # GitLab | Cleanup | Sessions | Clean ActiveSession look...
rake gitlab:container_registry:configure                        # GitLab | Container Registry | Configure
rake gitlab:db:clean_structure_sql                              # This adjusts and cleans db/structure.sql - it runs aft...
rake gitlab:db:composite_primary_keys_add                       # GitLab | DB | Adds primary keys to tables that only ha...
rake gitlab:db:composite_primary_keys_drop                      # GitLab | DB | Removes previously added composite prima...
rake gitlab:db:configure                                        # GitLab | DB | Configures the database by running migra...
rake gitlab:db:create_dynamic_partitions                        # Create missing dynamic database partitions
rake gitlab:db:downtime_check[ref]                              # GitLab | DB | Checks if migrations require downtime or...
rake gitlab:db:drop_tables                                      # GitLab | DB | Drop all tables
rake gitlab:db:dump_custom_structure                            # This dumps GitLab specific database details - it runs ...
rake gitlab:db:load_custom_structure                            # This loads GitLab specific database details - runs aft...
rake gitlab:db:mark_migration_complete[version]                 # GitLab | DB | Manually insert schema migration version
rake gitlab:db:reindex[index_name]                              # reindex a regular (non-unique) index without downtime ...
rake gitlab:db:setup_ee                                         # GitLab | DB | Sets up EE specific database functionality
rake gitlab:db:unattended                                       # GitLab | DB | Run database migrations and print `unatt...
rake gitlab:doctor:secrets                                      # GitLab | Check if the database encrypted values can be...
rake gitlab:env:info                                            # GitLab | Env | Show information about GitLab and its e...
rake gitlab:exclusive_lease:clear[scope]                        # GitLab | Exclusive Lease | Clear existing exclusive le...
rake gitlab:external_diffs:force_object_storage                 # Override external diffs in file storage to be in objec...
rake gitlab:features:enable_rugged                              # GitLab | Features | Enable direct Git access via Rugge...
rake gitlab:generate_sample_prometheus_data[environment_id]     # GitLab | Generate Sample Prometheus Data
rake gitlab:git:fsck                                            # GitLab | Git | Check all repos integrity
rake gitlab:gitaly:check                                        # GitLab | Gitaly | Check the health of Gitaly
rake gitlab:gitaly:install[dir,storage_path,repo]               # GitLab | Gitaly | Install or upgrade gitaly
rake gitlab:gitlab_shell:check                                  # GitLab | GitLab Shell | Check the configuration of Git...
rake gitlab:import:all_users_to_all_groups                      # GitLab | Import | Add all users to all groups (admin u...
rake gitlab:import:all_users_to_all_projects                    # GitLab | Import | Add all users to all projects (admin...
rake gitlab:import:repos[import_path]                           # GitLab | Import | Import bare repositories from reposi...
rake gitlab:import:user_to_groups[email]                        # GitLab | Import | Add a specific user to all groups (a...
rake gitlab:import:user_to_projects[email]                      # GitLab | Import | Add a specific user to all projects ...
rake gitlab:import_export:bump_version                          # GitLab | Import/Export | Bumps the Import/Export versi...
rake gitlab:import_export:data                                  # GitLab | Import/Export | Display exported DB structure
rake gitlab:import_export:export                                # GitLab | Import/Export | EXPERIMENTAL | Export large p...
rake gitlab:import_export:import                                # GitLab | Import/Export | EXPERIMENTAL | Import large p...
rake gitlab:import_export:version                               # GitLab | Import/Export | Show Import/Export version
rake gitlab:incoming_email:check                                # GitLab | Incoming Email | Check the configuration of R...
rake gitlab:ldap:rename_provider[old_provider,new_provider]     # GitLab | LDAP | Rename provider
rake gitlab:lfs:check                                           # GitLab | LFS | Check integrity of uploaded LFS objects
rake gitlab:lfs:migrate                                         # GitLab | LFS | Migrate LFS objects to remote storage
rake gitlab:orphans:check                                       # Gitlab | Orphans | Check for orphaned namespaces and r...
rake gitlab:orphans:check_namespaces                            # GitLab | Orphans | Check for orphaned namespaces in th...
rake gitlab:orphans:check_repositories                          # GitLab | Orphans | Check for orphaned repositories in ...
rake gitlab:packages:events:generate                            # GitLab | Packages | Events | Generate hll counter even...
rake gitlab:packages:migrate                                    # GitLab | Packages | Migrate packages files to remote s...
rake gitlab:praefect:replicas[project_id]                       # GitLab | Praefect | Check replicas
rake gitlab:seed:group_seed[subgroups_depth,username]           # Seed groups with sub-groups/projects/epics/milestones ...
rake gitlab:seed:issues                                         # GitLab | Seed | Seeds issues
rake gitlab:setup                                               # GitLab | Setup production application
rake gitlab:shell:build_missing_projects                        # GitLab | Shell | Build missing projects
rake gitlab:shell:install[repo]                                 # GitLab | Shell | Install or upgrade gitlab-shell
rake gitlab:shell:setup                                         # GitLab | Shell | Setup gitlab-shell
rake gitlab:sidekiq:check                                       # GitLab | Sidekiq | Check the configuration of Sidekiq
rake gitlab:snippets:list_non_migrated                          # GitLab | Show non migrated snippets
rake gitlab:snippets:migrate[ids]                               # GitLab | Migrate specific snippets to git
rake gitlab:snippets:migration_status                           # GitLab | Show whether there are snippet background mig...
rake gitlab:storage:hashed_attachments                          # Gitlab | Storage | Summary of project attachments usin...
rake gitlab:storage:hashed_projects                             # Gitlab | Storage | Summary of existing projects using ...
rake gitlab:storage:legacy_attachments                          # Gitlab | Storage | Summary of project attachments usin...
rake gitlab:storage:legacy_projects                             # Gitlab | Storage | Summary of existing projects using ...
rake gitlab:storage:list_hashed_attachments                     # Gitlab | Storage | List existing project attachments u...
rake gitlab:storage:list_hashed_projects                        # Gitlab | Storage | List existing projects using Hashed...
rake gitlab:storage:list_legacy_attachments                     # Gitlab | Storage | List existing project attachments u...
rake gitlab:storage:list_legacy_projects                        # Gitlab | Storage | List existing projects using Legacy...
rake gitlab:storage:migrate_to_hashed                           # GitLab | Storage | Migrate existing projects to Hashed...
rake gitlab:storage:rollback_to_legacy                          # GitLab | Storage | Rollback existing projects to Legac...
rake gitlab:tcp_check[host,port]                                # GitLab | Check TCP connectivity to a specific host and...
rake gitlab:test                                                # GitLab | Run all tests
rake gitlab:two_factor:disable_for_all_users                    # GitLab | 2FA | Disable Two-factor authentication (2FA)...
rake gitlab:two_factor:rotate_key:apply                         # GitLab | 2FA | Rotate Key | Encrypt user OTP secrets w...
rake gitlab:two_factor:rotate_key:rollback                      # GitLab | 2FA | Rotate Key | Rollback to secrets encryp...
rake gitlab:update_project_templates                            # GitLab | Update project templates
rake gitlab:update_templates                                    # GitLab | Update templates
rake gitlab:uploads:check                                       # GitLab | Uploads | Check integrity of uploaded files
rake gitlab:uploads:migrate                                     # GitLab | Uploads | Migrate the uploaded files of speci...
rake gitlab:uploads:migrate:all                                 # GitLab | Uploads | Migrate all uploaded files to objec...
rake gitlab:uploads:migrate_to_local                            # GitLab | Uploads | Migrate the uploaded files of speci...
rake gitlab:uploads:migrate_to_local:all                        # GitLab | Uploads | Migrate all uploaded files to local...
rake gitlab:uploads:sanitize:remove_exif                        # GitLab | Uploads | Remove EXIF from images
rake gitlab:usage_data:dump_sql_in_json                         # GitLab | UsageData | Generate raw SQLs for usage ping ...
rake gitlab:usage_data:dump_sql_in_yaml                         # GitLab | UsageData | Generate raw SQLs for usage ping ...
rake gitlab:web_hook:add                                        # GitLab | Webhook | Adds a webhook to the projects
rake gitlab:web_hook:list                                       # GitLab | Webhook | List webhooks
rake gitlab:web_hook:rm                                         # GitLab | Webhook | Remove a webhook from the projects
rake gitlab:workhorse:install[dir,repo]                         # GitLab | Workhorse | Install or upgrade gitlab-workhorse
rake gitlab:x509:update_signatures                              # GitLab | X509 | Update signatures when certificate sto...
rake grape:path_helpers                                         # Print route helper methods
rake grape:routes                                               # Print compiled grape routes
rake hipchat:send[message]                                      # Sends a HipChat message as a particular user
rake import:github[token,gitlab_username,project_path]          # GitLab | Import | Import a GitHub project - Example: i...
rake jira:generate_consumer_key                                 # Generate a consumer key for your application
rake jira:generate_public_cert                                  # Run the system call to generate a RSA public certificate
rake log:clear                                                  # Truncates all/specified *.log files in log/ to zero by...
rake metrics:setup_common_metrics                               # GitLab | Metrics | Setup common metrics
rake middleware                                                 # Prints out your Rack middleware stack
rake migrate_iids                                               # GitLab | Build internal ids for issues and merge requests
rake postgresql_md5_hash                                        # GitLab | Generate PostgreSQL Password Hash
rake raven:test[dsn]                                            # Send a test event to the remote Sentry server
rake restart                                                    # Restart app by touching tmp/restart.txt
rake secret                                                     # Generate a cryptographically secure secret key (this i...
rake setup                                                      # GitLab | Setup gitlab db
rake stats                                                      # Report code statistics (KLOCs, etc) from the applicati...
rake test                                                       # GitLab | Run all tests
rake test:db                                                    # Run tests quickly, but also reset db
rake test:system                                                # Run system tests only
rake time:zones[country_or_offset]                              # List all time zones, list by two-letter country code (...
rake tmp:clear                                                  # Clear cache, socket and screenshot files from tmp/ (na...
rake tmp:create                                                 # Creates tmp directories for cache, sockets, and pids
rake tokens:reset_all_email                                     # Reset all GitLab incoming email tokens
rake tokens:reset_all_feed                                      # Reset all GitLab feed tokens
rake yarn                                                       # Install Node dependencies with Yarn
rake yarn:available                                             # Ensure Yarn is installed
rake yarn:check                                                 # Ensure Node dependencies are installed
rake yarn:clobber                                               # Remove Node dependencies
rake yarn:install                                               # Install Node dependencies with Yarn / Install all Java...
rake zeitwerk:check                                             # Checks project structure for Zeitwerk compatibility

 

Posted by Uli Köhler in Ruby