-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Add Vagrantfile #1459
Add Vagrantfile #1459
Conversation
If I read the vagrantfile correctly, the two virtual hosts are on the VM itself, right. |
Yes. http://localhost:8080 for the framework. Tested MySQL and Postgres with Debian Testing all OK. But in Debian it is more complicated to configure the PHP version. Testing is coming with 7.3 and I noticed some bugs (do not recognize constant values as default values as function params). Tuning to work with Ubuntu. Instructions in the manual will be very good. Sorry, my English is not good. |
@lonnieezell I seem to recall you mentioning that you use vagrant. If that is the case, does this seem like a suitably generic approach? Anything to add? |
I used to use a virtual machine for it but currently just use it in MacOS. The script looks excellent (especially like the 3 different ports!). One thing I would love to see, though, is support for multiple PHP versions, since we sometimes need to debug in different versions to track down issues. I use a great little script, php-version which makes that painless. It would be awesome if this was supported out of the box. My only other concern is if this might conflict with using the built-in |
@lonnieezell I think it is easier to configure the VM to have apache running as a service, than it would be to have it use the spark server. Not sure how easy it would be to configure the spark server as an O/S service, hmmm. |
@natanfelles Why the "bionic" version of ubuntu? "trusty" has the lion's share of vagrantbnox downloads. I don't know if the platform version has (or should have) any effect on the testing/unit testing. |
@jim-parry Because it is the most current LTS version: https://www.ubuntu.com/about/release-cycle @lonnieezell I have not had the opportunity to use php-version yet. It would be nice to be able to test in several versions of PHP, in the VM. In the morning I was studying phpcov to merge the various tests and show them in the same coverage-html of the VM. To the local coverage be more similar to coverage/coveralls. The Vagrantfile is working. The VM occupies ~600MB RAM when running PHPUnit. And ~180MB of downloaded packages (~700MB after installation). Ah, @jim-parry , also with Sphinx ready to be used. I think this will help in editing the user guide. |
@natanfelles Good call, then :) |
.env for tests app.baseURL = 'http://example.com'
database.tests.hostname = localhost
database.tests.database = codeigniter
database.tests.username = root
database.tests.password = password
database.tests.DBDriver = Postgre # MySQLi, Postgre, SQLite3
database.tests.port = 5432 # MySQLi = 3306 # Postgre = 5432 Possible gaps: Apache is down after
|
Vagrantfile
Outdated
# Display the VirtualBox GUI when booting the machine | ||
vb.gui = false | ||
# Customize the amount of memory on the VM: | ||
vb.memory = "768" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
VM runs with 400MB, 308MB "stopped". Required ~600MB when running tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I run mine with 1024m. Probably overkill, but hoping/planning for near-complete code coverage eventually.
Is there much of a penalty specifying more memory?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It depends on the user's machine. Thinking about taking up as little resources as possible, I started with 512MB, but PHPUnit broke for not having enough memory to do the coverage. I run again and saw that it occupies about 600MB at most (MySQLi driver). I increased 256MB.
Testing now with the SQLite3 driver, PHPUnit also could not gererate the code coverage:
Type: ErrorException
Message: proc_open(): fork failed - Cannot allocate memory
Filename: /var/www/codeigniter/vendor/sebastian/version/src/Version.php
Line Number: 89
I'll go up to 1024 and test again. But this seems to me a very high value, I'm thinking of maybe already letting in the script instructions to create a swap file, because the memory only rises so much when it's generating code coverage.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SQLite3 with database.tests.database = ':memory:'
...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. Increased the default vb.memory
to 1024 and added script to auto add 1GB of swap if the VM has low RAM.
Tested using SQLite3 with vb.memory = "512"
and no problem. It used ~120MB of swap during coverage.
@natanfelles I really like what you're building here. Thanks! |
What do yous prefer to be the default:
I prefer the second option, but the user will need to update their
|
I prefer the virtual host approach myself - more realistic IMHO. |
Yes. 192.168.10.10 is the VM IP. The developer can access directly or by a custom domain (codeignter.test by default, maybe) |
or |
b47a0a9
to
01379fb
Compare
01379fb
to
73450c8
Compare
"Vagrantfile" & ".vagrant" are currently in the .gitignore file. |
Description
Closes #1452
Work in progress. Idea is to be able to just clone the repository and simply run a
vagrant up
.Adding two vhost - one for the framework, another for PHPUnit Code Coverage HTML.
I did not have time with docker yet - I think is not possible adjust everything in a single file with docker...
Checklist: