HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Setting up Vanilla via cURL
Linc
Admin
I'm trying to set up a Vanilla site from a bash prompt. I've tried lots of flags in lots of formats (using -F; joining the parameters together with ampersands; and so on) and I either get back the form in HTML with an error, or I get nothing at all. Here's what I tried last:
read -p "Name: " SITE curl -d "Database-dot-Host=localhost" -d "Database-dot-Name=${SITE}" -d "Database-dot-User=root" -d "Database-dot-Password=" -d "Garden-dot-Title=${SITE}" -d "Email=lincoln%40vanillaforums.com" -d "Name=admin" -d "Password=admin" -d "PasswordMatch=admin" http://${SITE}.dev/index.php?p=/dashboard/setup
Any ideas how to get this thing to work? What am I missing?
0
Comments
I tried what you did. I get this.
Failed to connect to the database with the username and password you entered. Did you mistype them? The database reported:
SQLSTATE[28000] [1045] Access denied for user 'root'@'localhost' (using password: NO)
I suppose if I create the database first, it might work.
what errors do you see in the html reported?
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
I don't know command line curl. I know you need to POST and not GET. Can you try writing this as a php script and do that from the command line?
you may have rip the transient key, curl does not automatically handle redirects check trailing slashes, etc.
grep is your friend.
here is what I did and it created vanilla.
but i had to create the table first.
I modified a bit what you had to point to where I wanted to go
and put it in a text file called testfile
I chmoded the config uploads and something else as standard.
I created the database via phpmyadmin.
I then ran the command as
sh -x testfile
and it completed and populated the database with tables. and properly created a config.php.
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
and then i typed
http://localhost/vanilla3/
and it shows the discussion page and shows the discussion page as bam you've got a sweet forum.
Not sure what you were trying to do, but as long as you create the database first.
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
obviously if you didn't want to see html output you could redirect to dev/null
note the password is the same password I used in database creation.
but it created the following 2 users in the user table
admin with lincolns email
and system user
this is the config it created.
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
@peregrine Maybe it doesn't like the blank MySQL password field in mine? That's maddening that it's working as expected for you. I get no error, but then I go to the site and it throws me to the setup page. It makes a blank config.php and no database tables.
Errors I've gotten have generally been related to malformed cURL requests as I was muddling thru the docs and trying different things. Perversely, I actually enjoy getting an error since it's a sign SOMETHING is actually happening.
There's no transient key during setup because you have no user session. The redirect isn't required for setup either, I checked the code.
maybe this will help.
mind you everything I'm doing is from localhost on localhost. perhaps a remote system has different ways of reporting errors back.
no password and no database created via phpmyadmin
everything on localhost
with database created - no password
another scenario
create vanilla3 table with phpmyadmin
create sql user for vanilla3 via phpmyadmin with NO password.
CREATE USER 'vanilla3pass'@'%';
GRANT USAGE ON * . * TO 'vanilla3pass'@'%' WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0 ;
GRANT ALL PRIVILEGES ON
vanilla3
. * TO 'vanilla3pass'@'%';testfile contents:
execution:
results: perfect setup
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
very cool script you wrote. I hope you get it working for yourself. i certainly like it.
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
I figured it out. You can't post to the form before you've requested the form. I added a curl to the page before posting to it, works great now.
Actually, I think you can. I did the same in my ANT script that I use to run tests against my Vanilla plugins, and I use CURL to "trick" Vanilla into configuring a brand new website every time. I just run a single CURL command, posting to the /setup URL, and it works.
Note: the CURL is executed using an
exec
task, which, I think, runs the command line tool installed on Linux.Extracted from ANT file
My shop | About Me
Well, tell that to my localhost! :P
My ANT script runs against a localhost too. My localhost is better than your localhost. :P
Maybe it's a Buddhist localhost, more tolerant.
My shop | About Me
You're saying this to the co-owner of NewBuddhist.com. 0.o
Well, then my Buddhist localhost is better than your Buddhist localhost. A little bit more nonsense and we can go straight into the Twilight Zone...
My shop | About Me
I can confirm that prerequisites are required in newer versions of vanilla (2.1), it worked in older versions.
alternative to
curl -s http://${SITE}.dev/index.php?p=/dashboard/setup > /dev/null
is to create a blank
conf/config.php
file with the correct permissions, ideally assigned to the web user. Then it works first time.Hope that helps.
grep is your friend.
A-ha! Now that I think about it, I only run tests against 2.0.x, which explains why it works. Good finding.
My shop | About Me
Thanks for proving I'm not crazy @x00