Bug 970150
Summary: | Ruby asset compilation fails if the app name starts with a numeral | ||
---|---|---|---|
Product: | OpenShift Online | Reporter: | Fotios Lindiakos <fotios> |
Component: | Containers | Assignee: | Hiro Asari <hasari> |
Status: | CLOSED CURRENTRELEASE | QA Contact: | libra bugs <libra-bugs> |
Severity: | medium | Docs Contact: | |
Priority: | medium | ||
Version: | 2.x | CC: | bmeng, dmace, jkeck, qiuzhang, xtian |
Target Milestone: | --- | ||
Target Release: | --- | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | Bug Fix | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2013-08-29 12:47:35 UTC | Type: | Bug |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: |
Description
Fotios Lindiakos
2013-06-03 14:37:42 UTC
So this may not be a "bug" in Rails. Rails does not allow app names of all numbers: rails new 12345 Invalid application name 12345. Please give a name which does not start with numbers. Not sure how this should be handled, will bring it up with the runtime team. Marking as future feature. Note: We are only looking for a better error message for the fix. Commit pushed to master at https://github.com/openshift/origin-server https://github.com/openshift/origin-server/commit/6400c02c79d3a7dfd7f5d7884bbcb72d8fcd1dc1 Bug 970150 Fail early during the build cycle if a Rails app name starts with a numeral. We should fail before we run `bundle install`, since it is completely unnecessary if Rails can't run. If the application is created with `--from-code`, the initial build will fail, with error message like this: ``` Creating application '12345' ... The initial build for the application failed: Shell command '/sbin/runuser -s /bin/sh 80e4c0ea037a11e3962922000ab2046b -c "exec /usr/bin/runcon 'unconfined_u:system_r:openshift_t:s0:c0,c502' /bin/sh -c \"gear postreceive >> /tmp/initial-build.log 2>&1\""' returned an error. rc=255 .Last 10 kB of build output: Stopping Ruby cart httpd (no pid file) not running Invalid Rails application name. Please delete this applicatin and re-create it with a name which does not start with numbers An error occurred executing 'gear postreceive' (exit code: 1) Error message: Failed to execute: 'control pre-build' for /var/lib/openshift/80e4c0ea037a11e3962922000ab2046b/ruby For more details about the problem, try running the command again with the '--trace' option. ``` If the application is created from a template Rack app, and updated via `git pull -s recursive -X theirs`, the build will fail on the first push: ``` remote: Stopping Ruby cart remote: Waiting for stop to finish remote: CLIENT_ERROR: Invalid Rails application name. Please delete this applicatin and re-create it with a name which does not start with numbers remote: An error occurred executing 'gear postreceive' (exit code: 1) remote: Error message: Failed to execute: 'control pre-build' for /var/lib/openshift/520924b77b2a19115a000001/ruby remote: remote: For more details about the problem, try running the command again with the '--trace' option. To ssh://520924b77b2a19115a000001.rhcloud.com/~/git/12345.git/ 9b5a31d..398f08a master -> master ``` Tested on devenv_3641, with 2 methods, both of them can show the useful information about the invalid app name. The initial build for the application failed: Shell command '/sbin/runuser -s /bin/sh 1747d54603fc11e3aa2722000a904a26 -c "exec /usr/bin/runcon 'unconfined_u:system_r:openshift_t:s0:c0,c549' /bin/sh -c \"gear postreceive >> /tmp/initial-build.log 2>&1\""' returned an error. rc=255 .Last 10 kB of build output: Stopping Ruby cart httpd (no pid file) not running Invalid Rails application name. Please delete this applicatin and re-create it with a name which does not start with numbers An error occurred executing 'gear postreceive' (exit code: 1) Error message: Failed to execute: 'control pre-build' for /var/lib/openshift/1747d54603fc11e3aa2722000a904a26/ruby For more details about the problem, try running the command again with the '--trace' option. remote: CLIENT_ERROR: Invalid Rails application name. Please delete this applicatin and re-create it with a name which does not start with numbers remote: An error occurred executing 'gear postreceive' (exit code: 1) remote: Error message: Failed to execute: 'control pre-build' for /var/lib/openshift/5209ef11af319a22f5000004/ruby remote: remote: For more details about the problem, try running the command again with the '--trace' option. To ssh://5209ef11af319a22f5000004.rhcloud.com/~/git/191919.git/ 55b1fbd..c4b5a93 master -> master But there is a typo in the error message, the 2nd 'applicatin' should be 'application'. I assign this bug back to fix the text issue. The 2 methods in the last comment are: 1. Create rails app with --from-code rhc app create 12345 ruby-1.9 mysql-5.1 --from-code https://github.com/openshift/rails-example --debug 2. Add the code to an existing app with following the steps in https://github.com/openshift/rails-example It turns out that the previous commit broke every Rails app ("foo", say). The fix should be landing soon. Commit pushed to master at https://github.com/openshift/origin-server https://github.com/openshift/origin-server/commit/b46b39cd9d0894b38b5507cc1572c08d7e9dfe33 Follow up fix for Bug 970150 It turns out that 6400c02 wasn't really working. The inner `if` clause, `$?` is `0` no matter what the result from the app name check, so that any app name would fail for Rails. This fixes that. The above analysis regarding $? may not be correct, but the symptom is accurately described (that all Rails apps failed), and the fix works. https://github.com/BanzaiMan/origin-server/commit/b46b39cd9d0894b38b5507cc1572c08d7e9dfe33#commitcomment-3849430 Checked on devenv_3646, issue has been fixed. For app with numeric name, it will return correct error message. And for normal app, rails app can be created successfully. 1. .Last 10 kB of build output: Stopping Ruby cart httpd (no pid file) not running Invalid Rails application name. Please delete this application and re-create it with a name which does not start with numbers An error occurred executing 'gear postreceive' (exit code: 1) Error message: Failed to execute: 'control pre-build' for /var/lib/openshift/799f01ee049011e38d5912313d04e829/ruby For more details about the problem, try running the command again with the '--trace' option. 2. rhc app create rails ruby-1.9 mysql-5.1 --from-code https://github.com/openshift/rails-example Application Options ------------------- Namespace: bmengdev Cartridges: ruby-1.9, mysql-5.1 Source Code: https://github.com/openshift/rails-example Gear Size: default Scaling: no Creating application 'rails' ... done MySQL 5.1 database added. Please make note of these credentials: Root User: adminzKjlLUg Root Password: YIcGfg5xbhDq Database Name: rails Connection URL: mysql://$OPENSHIFT_MYSQL_DB_HOST:$OPENSHIFT_MYSQL_DB_PORT/ You can manage your new MySQL database by also embedding phpmyadmin-3.4. The phpmyadmin username and password will be the same as the MySQL credentials above. Waiting for your DNS name to be available ... done Cloning into 'rails'... Warning: Permanently added 'rails-bmengdev.dev.rhcloud.com,184.73.5.34' (RSA) to the list of known hosts. Your application 'rails' is now available. URL: http://rails-bmengdev.dev.rhcloud.com/ SSH to: 842397002501180239118336.rhcloud.com Git remote: ssh://842397002501180239118336.rhcloud.com/~/git/rails.git/ Cloned to: /root/openshiftest/rails Run 'rhc show-app rails' for more details about your app. Commit pushed to master at https://github.com/openshift/origin-server https://github.com/openshift/origin-server/commit/a9045a821710bd90217504d060d6b5827e8f330a Allow numeric-only Rails app names In Bug 970150, we introduced the check to enforce an arbitrary restriction that the Rails application names cannot start with a numeral. While it is true that `rails new` fails if the application name starts with a numeral, this restriction should not prevent OpenShift from hosting such an application. Our quickstart now has a workaround: https://github.com/openshift/rails-example/pull/29 The issue should be addressed in `mysql2` gem as well. For reference: https://bugzilla.redhat.com/show_bug.cgi?id=1014317 |