Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Vagrant and Readme so the development environment actually works. #3

Closed
NSkelsey opened this issue Sep 16, 2013 · 16 comments
Closed

Comments

@NSkelsey
Copy link
Member

I just started trying to get this working on my machine. The main problem right now is that a file config.inc.php (for phpmyadmin I assume) is not included in the statedecoded repository. There needs to be an example one included either in this repository or the main php with the nessecary constants filled out. Waldo could you sanitisize yours and push into this repo?

@waldoj
Copy link
Member

waldoj commented Sep 16, 2013

It is included—you just need to rename includes/config-sample.inc.php to includes/config.inc.php. See the installation instructions for details.

@waldoj waldoj closed this as completed Sep 16, 2013
@waldoj waldoj reopened this Sep 16, 2013
@waldoj
Copy link
Member

waldoj commented Sep 16, 2013

I should mention that the project has undergone a great deal of modifications since the last tagged release! I'll take a few minutes to amend the README here, to function more or less properly.

The obstacles that I've been having a heck of a time overcoming aren't actually getting The State Decoded running within Vagrant, it's getting Vagrant configured to get to the point where it's possible to do that! :) Once somebody can run vagrant up and get an environment that a) has all of the required programs installed (php-curl, mysql, etc.) and b) responds to the user entering a development address like http://wwwstatedecoded.dev/, then it'll be straightforward for me to update the instructions to interface with The State Decoded properly. After all, that's what I do all of the project development on. :)

waldoj added a commit that referenced this issue Sep 16, 2013
@NSkelsey
Copy link
Member Author

Ok, I will start working on that. Later tonight

@waldoj
Copy link
Member

waldoj commented Sep 16, 2013

That'll give me to find other dumb oversights I've made. :)

@NSkelsey
Copy link
Member Author

Ok, I dove into this using both the readme and the docs you linked to forge ahead. I checked out v0.7 and used that as stable branch. After acouple hours I couldn't quite get the parser to do everything it should, but I have some ideas on how to move forward. I am recording all of the things that need tweaking + all of the gotchas.

Anyways onto some substance:

Currently when I try to run the parser it breaks on "generating structural statistics"
With this error generated:
[Tue Sep 17 04:50:23 2013] [error] [client 192.168.56.1] PHP Warning: Invalid argument supplied for foreach() in /var/www/example.dev/includes/parser-controller.inc.php on line 651, referer: http://192.168.56.101/admin/parser.php [Tue Sep 17 04:50:23 2013] [error] [client 192.168.56.1] PHP Stack trace:, referer: http://192.168.56.101/admin/parser.php [Tue Sep 17 04:50:23 2013] [error] [client 192.168.56.1] PHP 1. {main}() /var/www/example.dev/htdocs/admin/parser.php:0, referer: http://192.168.56.101/admin/parser.php [Tue Sep 17 04:50:23 2013] [error] [client 192.168.56.1] PHP 2. ParserController->structural_stats_generate() /var/www/example.dev/htdocs/admin/parser.php:102, referer: http://192.168.56.101/admin/parser.php

I think this is because I did not specify these constants in config.inc.php

  • GLOBAL_DEFINITIONS
  • STRUCTURE # I left it as default

Here is a gist of my current file

Its worth noting that, I do not see any records persisting in mysql, and at this point in the code we are clearly querying for records. So maybe it is a deeper mysql problem. Any help is appreciated.

@waldoj
Copy link
Member

waldoj commented Sep 17, 2013

Just so that I can be working off the same page as you, how did you deal with the problems presented by #1 and #2? #1, in particular, has been a deal-breaker for me—firing up an instance of Vagrant with this configuration doesn't let me punch through to any hosted HTML. Once I can duplicate your setup, I'll be more useful. More important than that, once I can get those two basic problems solved, I think it becomes pretty easily to wrap this up!

@NSkelsey
Copy link
Member Author

For Issue #1 I disabled the default site enabled in /etc/apache2/sites-enabled. When Apache is initially installed it enables a default site that uses /var/www/ as its doc root. For #2 all I did was remove the host-updater lines from the Vagrantfile and just used 192.168.56.101 as the address of the dev site on my host machine. If you do not want to/cannot go in and manually edit /etc/hosts on your host machine, which allows you to use a hostname for the site, I can understand the need for a more complicated solution.

Another problem I noticed is that when you set /var/www/ as the shared folder you lose the ability to modify owernship of directories, but not files, which may be a problem specific to my setup. Consequently I moved the shared folder off of /var/www/.

Here is the gist of my new Vagrantfile

@waldoj
Copy link
Member

waldoj commented Sep 18, 2013

I'm going to try this out tomorrow (I note we're on opposite schedules :), but your solution makes perfect sense. I probably shouldn't have let myself get hung up on having a development hostname—there are surely worse things than having people enter an IP address. :)

@NSkelsey
Copy link
Member Author

Ok, hopefully when you get to where I am stuck there is a simple solution.

@waldoj
Copy link
Member

waldoj commented Sep 19, 2013

Sorry for the delay here—I'm trying to figure out how to disable default in /etc/apache2/sites-enabled/ at the time that somebody runs vagrant up, rather than requiring that they do so manually. This has to be done in Puppet, which I don't have any experience with, so I'm headed up the learning curve now. :)

@NSkelsey
Copy link
Member Author

Waldo that is something I would be happy to figure out how to do. I was planning on branching the current repo making a bunch of changes and the pulling them back in this weekend. If you let me worry about puppet for the next week, I will get it usable and well documented.

But if you can solve these problems now then by all means!

@waldoj
Copy link
Member

waldoj commented Sep 19, 2013

Well, that's certainly not something I'm inclined to argue with. :) Thanks, Nick!

@NSkelsey
Copy link
Member Author

I just need to know if the problem I am having with the parser failing at generating structural statistics is due to misconfiguration of my setup, which I think it is because I have not defined all of the variables in config.inc.php.

So what needs to change here?

*********Also I am using the virginia xml files

@waldoj
Copy link
Member

waldoj commented Sep 19, 2013

I don't think you're doing anything wrong—your config file looks fine. I'm not quite sure what's going wrong, but I've got a work-around for now—we'll just skip running structural_stats_generate(). That won't break anything important. Just edit htdocs/admin/parser.php, and find this stanza on line 99:

$parser->parse();
$parser->write_api_key();
$parser->export();
$parser->structural_stats_generate();
$parser->clear_apc();
$parser->prune_views();

You can just delete $parser->structural_stats_generate();, on line 102. See if that fixes things for you.

@NSkelsey
Copy link
Member Author

I figured it out. The code was in xml/code/ instead of just xml. Forgot to unpack the directory X_X... I will add a test case to check for this.

@waldoj
Copy link
Member

waldoj commented Sep 20, 2013

Ah, I've done that myself. :) The version under development (the UI branch) adds a couple of dozen tests, including making sure that the import data is present, which I hope will prevent this for others. Sorry about that!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants