non interactive execution of bundle exec rake db:configure_admin - canvas-lms

I'm trying to automate installation of canvas lms, and I need to know how to run "bundle exec rake db:configure_admin" command in non-interactive mode as it asks me for admin email/password ?
Thanks

It should be done by setting the following environmental variables :
CANVAS_LMS_ADMIN_EMAIL
CANVAS_LMS_ADMIN_PASSWORD

Related

'ALGOLIA_API_KEY' not recognized as an internal or external command

I am trying to run algolia for the first time but it seems that there is something wrong with my environment. I followed the detailed explanation here https://community.algolia.com/jekyll-algolia/getting-started.html.
I installed and configured everything that is needed from the previous steps but when I run the command
ALGOLIA_API_KEY=xxxxxxxxxxxxxx bundle exec jekyll algolia
I get an error:
'ALGOLIA_API_KEY' is not recognized as an internal or external command,
operable program or batch file.
I have been rereading the documentation for both jekyll and angolia but couldn't find anything that could be helpful.
Since you're running on Windows, you cannot set an environment variable for your command like you can do on UNIX.
As advised in this question, Setting and using variable within same command line in Windows cmd.exe, I believe you could use
set ALGOLIA_API_KEY=xxxxxxxxxxxxxx && bundle exec jekyll algolia

gitlab Health Check is Unhealthy

I'm migration my gitlab to another server. the old gitlab server use postgresql and the new gitlab server use mysql.
I'm convert it with tools calld “DBConvert for MySQL & PostgreSQL”.
Database had sucess convert , and the repo files also copyd to the new gitlab server.
But my projects can't use , when click the projects it notice http code 500.
In gitlab Health check ,it notice
Migrations are pending.
To resolve this issue, run: bin/rake db:migrate RAILS_ENV=production"
And when I run this cmd , it notice "No Rakefile found"
How to proceed from there?
Make sure to execute bin/rake db:migrate RAILS_ENV=production from your GitLab-CE installation folder.
Or try from the same GitLab folder:
bundle exec rake db:migrate RAILS_ENV=production"
my src and dst gitlab version are 8.8.4 , it's the same
In that case, simply do not execute any db:migrate RAILS_ENV=production: that will avoid creating duplicate tables.
Problem is resloved , see link How to resloved "Migrations are pending. To resolve this issue, run: bin/rake db:migrate RAILS_ENV=production".

rake failure due to imagemagick

I'm seeding a development database (mysql) using rake db:seed in Rails 3. The rake task fails, stating,
Validation failed: Logo /var/folders/.../logo.png is not recognized by the 'identify' command.
When I run which identify, I get the expected path /usr/local/bin/identify. ImageMagick is indeed installed (via Homebrew), and appears to work with png images just fine from the command line.
I even rebuilt the app on another machine, thinking that my environment is borked, and I got the same error.
Is there a poltergeist in my terminal sessions?
Have you tried running a bundle exec before the rake. In the past this has often solved these sorts of problems for me. It will ensure your rails environment is loaded before running the rake task.
bundle exec rake db:seed
Hope that helps!
// Addition
Also are you using the Paperclip gem to do this import? I do remember that I needed to ensure the path to ImageMagick was set in my development.rb file to ensure this was picked up.
Eg.
Paperclip.options[:command_path] = "/usr/local/bin"

How to add path variable to job shell

I am setting up Jenkins to replace our current TeamCity CI build.
I have created a free-style software project so that I can execute a shell script.
The Shell script runs the mvn command.
But the build fails complaining that the 'mvn' command cannot be found.
I have figured that this is because Jenkins is running the build in a different shell, which does not have Maven on it's path.
My question is; how do I add the path so 'mvn' is found in my Shell script? I've looked around but can't spot where the right place might be.
Thanks for your time.
I solved this by exporting and setting the Path in the Jenkins Job configuration where you can enter shell commands. So I set the environments variable before I execute my Shell script, works a treat.
Some possible solutions:
You can call maven with an absolute path
You configure a global environment variable in the jenkins system settings with the absolute path to your maven instance, and use this in your script call (if you use the inline shell script, I don't know if those are substituted to a called script, you have to test)
You use a maven project and configure your maven instance in the jenkins system settings
ps.: Usually /bin/sh is chosen from Jenkins, if you want to switch to eg. bash, you can configure this in the jenkins system settings, in case you want to configure global environment variables.
You can use envInject plugin. It's very powerful.
I use it to install rbenv. And it can inject environment variables into your current job.
Another option to Dags suggestion is that if you're only using a single version of maven, on each slave server you could do either;
* add PATH=${PATH}:
* symlink mvn into /usr/bin with; sudo ln -s /usr/bin
I'm not at a Jenkins box at the moment, but I can find some more detailed examples if you'd like.
Jenkins is using sh by default and not bash.
This is my first time defining a jenkins maven job, and I also followed soem regular maven instructions (for running from command line...), and tried to update ~/.bashrc with M2_HOME, M2, PATH, but it didn't work because jenkins used sh and not bash. Then I found out that there is a simpler and better way built into jenkins.
After installing maven, I was supposed to configure my maven installation in jenkins.
To configure your maven installation in Jenkins:
login to jenkins web console
click Manage Jenkins --> Configure System
Under Maven, click the "Maven Installations..." button
a. Give it some name
b. and under MVN_HOME set the path to where you installed maven, for example "/usr/local/apache-maven/apache-maven-3.0.5"
Click Save button
Define a job with maven target
edit your job
Click "Add build step"
on Maven Version, enter the name you gave your maven installation (step #4 above)
set some goal like clean install

NSIS - jruby fails to access environment variables

I've made a NSIS script to create an installer for a Rails application.
The application uses JRuby and Java.
In the first section of the installer I set the environment variables: I add jruby\bin to PATH and I create JAVA_HOME variable, which points to Java\jre6.
!define JRubyBinPath "$PROGRAMFILES\${PRODUCT_PUBLISHER}\JRuby\jruby-1.6.3\bin"
Function SetEnvVars
# set JAVA_HOME
${EnvVarUpdate} $0 "JAVA_HOME" "A" "HKCU" "C:\Program Files\Java\jre6"
# add jruby to Path
${EnvVarUpdate} $0 "Path" "A" "HKLM" "${JRubyBinPath}"
FunctionEnd
Section "Pre" SEC01
Call SetEnvVars
...
SectionEnd
** All the paths are correct. **
In the second section of the installer, after packing all the application files and JRuby files, I initialize the database using the following commands:
Section "Installer" SEC02
...
SetOutPath $INSTDIR
nsExec::ExecToLog "jruby -S bundle exec rake db:create RAILS_ENV=production"
nsExec::ExecToLog "jruby -S bundle exec rake db:migrate RAILS_ENV=production"
nsExec::ExecToLog "jruby -S bundle exec rake db:seed RAILS_ENV=production"
...
SectionEnd
The problem is that when I run the installer on a clean Windows system, all the code executes correctly, except for the lines that contain commands using "jruby". I get no error in the installer window, it just won't execute those lines.
Anyway, if I manually run those commands in a console right after the installer finishes, everything works as expected.
From what I have seen so far, the problem is that the installer cannot access the environment variables until it finishes.
* What I have done so far to solve this problem is creating the main installer Installer.exe (here I pack all the files and I set the environment variables), and another executable Init.exe which initializes the database.
If I manually run these executables - first Installer.exe then Init.exe - the application installs correctly. But if I try to launch Init.exe from Installer.exe, it won't work.
However, if there would be a way to execute the "jruby" commands in a new/different thread than the one that sets the environment variables, I think the problem would be solved. But I still couldn't find the way to do that.
Thanks.
NSIS doesn't have any threading. Apparently not quite true—but in your own code, you don't get to use threads.
You may need to set PATH for the current process; I'm not familiar with ${EnvVarUpdate}, but looking at its script it doesn't seem to updates the variable in the current process. Try this:
${EnvVarUpdate} $0 PATH A HKLM "${JRubyBinPath}" # The line you already have
System::Call Kernel32::SetEnvironmentVariable(t"PATH",tr0)
Another note: you are hard-coding JRubyBinPath; are you sure you really want to do that?