Code Monkey home page Code Monkey logo

nitro's Introduction

Craft Nitro icon

Craft Nitro

Nitro is a speedy local development environment that’s tuned for Craft CMS, powered by Docker.

Warning Nitro has been retired. Read more in our blog post, Retiring Craft Nitro.


Building from Source

If you’d like to build Nitro directly from source to test a PR or unreleased feature, you’ll need go and make in order to build a CLI binary for your OS.

If you’re on macOS running Homebrew and the Apple developer tools that come with Xcode, it should be quick and straightforward:

  1. Run brew install golang.
  2. Check out this repository and cd /path/to/your/checkout.
  3. Run make local.

Nitro’s dependencies will be downloaded automatically, and the built binary will be moved to /usr/local/bin/nitro.

Make sure that’s exactly what you see when you run which nitro:

$ which nitro
/usr/local/bin/nitro

If you installed Nitro with Homebrew, you might need to run brew unlink nitro so that the system uses the freshly-built binary instead. (To go back to using the Homebrew Nitro binary, use brew link --overwrite nitro.)

nitro's People

Contributors

angrybrad avatar bencroker avatar brandonkelly avatar gsumpster avatar jamesmacwhite avatar jasonmccallister avatar lukeholder avatar marionnewlevant avatar nfourtythree avatar pulkitkrishna00 avatar robinbisping avatar rostockahoi avatar sa3dany avatar spib avatar thegodshatetexas avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

nitro's Issues

the nitro exe should be location aware

for example, if you have:

  --dev
    --projectA
    --projectB

Where projectA is a nitro VM and you execute nitro from inside that project, there shouldn't be a need to specify --machine projectA in CLI commands.

Add global installation

It would be helpful to have an installer that would enable nitro as a global cli.

There are some useful installer scripts we could use but we should also have a brew formula for macOS.

ImageMagick with webp support

Installing ImageMagick, specifically with webp support for PHP, can be annoying. It would be wonderful if Nitro came out of the box with the option to use GD or ImageMagick and modern presets. (Some hosts and provisioning services do this by default and it’s fabulous—many do not and it can be a struggle.)

The end goal is to run php --info and see WEBP included in the imagick extension’s supported formats:

$ php --info | grep 'supported formats'
ImageMagick number of supported formats:  => 230
ImageMagick supported formats => 3FR, AAI, AI, ART, ARW, AVI, AVS, BGR, BGRA, BGRO, BIE, BMP, BMP2, BMP3, BRF, CAL, CALS, CANVAS, CAPTION, CIN, CIP, CLIP, CMYK, CMYKA, CR2, CRW, CUR, CUT, DATA, DCM, DCR, DCX, DDS, DFONT, DJVU, DNG, DOT, DPX, DXT1, DXT5, EPDF, EPI, EPS, EPS2, EPS3, EPSF, EPSI, EPT, EPT2, EPT3, ERF, EXR, FAX, FILE, FITS, FRACTAL, FTP, FTS, G3, G4, GIF, GIF87, GRADIENT, GRAY, GROUP4, GV, H, HALD, HDR, HISTOGRAM, HRZ, HTM, HTML, HTTP, HTTPS, ICB, ICO, ICON, IIQ, INFO, INLINE, IPL, ISOBRL, ISOBRL6, JBG, JBIG, JNG, JNX, JPE, JPEG, JPG, JPS, JSON, K25, KDC, LABEL, M2V, M4V, MAC, MAGICK, MAP, MASK, MAT, MATTE, MEF, MIFF, MKV, MNG, MONO, MOV, MP4, MPC, MPEG, MPG, MRW, MSL, MSVG, MTV, MVG, NEF, NRW, NULL, ORF, OTB, OTF, PAL, PALM, PAM, PANGO, PATTERN, PBM, PCD, PCDS, PCL, PCT, PCX, PDB, PDF, PDFA, PEF, PES, PFA, PFB, PFM, PGM, PICON, PICT, PIX, PJPEG, PLASMA, PNG, PNG00, PNG24, PNG32, PNG48, PNG64, PNG8, PNM, PPM, PREVIEW, PS, PS2, PS3, PSB, PSD, PTIF, PWP, RADIAL-GRADIENT, RAF, RAS, RAW, RGB, RGBA, RGBO, RGF, RLA, RLE, RMF, RW2, SCR, SCT, SFW, SGI, SHTML, SIX, SIXEL, SPARSE-COLOR, SR2, SRF, STEGANO, SUN, SVG, SVGZ, TEXT, TGA, THUMBNAIL, TIFF, TIFF64, TILE, TIM, TTC, TTF, TXT, UBRL, UBRL6, UIL, UYVY, VDA, VICAR, VID, VIFF, VIPS, VST, WBMP, WEBP, WMF, WMV, WMZ, WPG, X, X3F, XBM, XC, XCF, XPM, XPS, XV, XWD, YCbCr, YCbCrA, YUV

This wiki has been helpful for me in the past:
https://github.com/rosell-dk/webp-convert/wiki/Installing-Imagick-extension-with-WebP-support

Multipass installation

See if it's possible to check if Multipass is installed and if not, automatically download

[FR] add command to get the database user password

This would display the database password which is unique to each machine and shared across each type of database.

nitro database password

I'm going to make this a subcommand as I think it would be interesting to try to add a backup command.

Add support for HTTPS

This command would create a certificate for local development. We should look at using this library: https://github.com/FiloSottile/mkcert

nitro --machine=nitro-dev cert

For simplicity, we should create *.test certificates. Still need to research the feasibility of this.

[FR] add hosts command

To obfuscate the IP address, we should add the ability to automatically edit the hosts file for the user. This library (https://github.com/txn2/txeh) might work, but need to check the license.

nitro --machine=nitro-dev hosts add example.test

Documentation

We need to add documentation, at least in the README.md, during the beta. Might be worth having @mattstein look at adding a local development section to the Craft CMS docs.

[FR] add config file support

In order to make providing defaults to a machine, we should offer support for a YAML file that sets these flags. The CLI package already support YAML and TOML.

nitro init --config nitro.yml

Here is an example project that uses the alternate source:

package main

import (
	"fmt"
	"os"

	"github.com/urfave/cli/v2"
	"github.com/urfave/cli/v2/altsrc"
)

func main() {
	flags := []cli.Flag{
		// must have flags wrapped in altsrc.NewIntFlag
		// create a file test.yaml with key => value that matches flags
		altsrc.NewIntFlag(&cli.IntFlag{Name: "test"}),
		&cli.StringFlag{Name: "file", Usage: "the config file to load", DefaultText: "test.yaml"},
		altsrc.NewStringFlag(&cli.StringFlag{Name: "hello", DefaultText: "nitro!!!"}),
	}

	app := &cli.App{
		Action: func(c *cli.Context) error {
			fmt.Println(c.Int("test"))
			fmt.Println(c.String("hello"))
			return nil
		},
		Before: altsrc.InitInputSourceWithContext(flags, altsrc.NewYamlSourceFromFlagFunc("file")),
		Flags:  flags,
	}

	app.Run(os.Args)
}

Example YAML file

hello: this
test: 1

Backup command

Would be awesome if nitro had a way to backup and database from the host and restore without having to shell in.

[FR] add service restart command

It’d be ideal to have a command that could behave similarly to systemctl for restarting the services Nitro provides. Possibly something like...

  • nitro service start to send a start command to all of them
  • nitro service stop to send a stop command to all of them
  • nitro service restart to send a restart command to all of them
  • flags for each like nitro service restart --nginx --mysql to restart only nginx and mysql

Otherwise, we’ll all need to have a conversation about sudo and whatever the best practices are for restarting services within the machine.

[FR] command to delete host

It’d be nice to delete a host Nitro created for me if I want a do-over. Use case: I created a host using PHP 7.4, and PHP 7.5 came out.

fastcgi_read_timeout setting

We should set the fastcgi_read_timeout to 240 inside of the nginx vhost block for a site to match php.ini's max_execution_time as well as nginx's request_terminate_timeout.

Facility or best practice for customizing nginx config

Anyone comfortable with nginx will most likely want to tailor its config with project-specific considerations like cache fragments or custom headers or whatever. Ideally there would be either a specific, prescribed way of doing that or a recommended best practice so the end user could keep their config versioned and not create a Nitro hairball. (Which would smell terrible.)

[FR] add XDebug support

Probably disabled by default (because speed!), with a console command to switch it on and off. Something like Homestead’s xon and xoff.

add info command?

Displays basic VM info. I feel like there was one, but it's gone now?

Database updates

In the current VM, the MariaDB version is 10.1.44.

mysql Ver 15.1 Distrib 10.1.44-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2

We should update to the latest (10.5?) as things like native json column support didn't get introduced until 10.3.

Postgres support busted

ubuntu@playbill:~/sites/playbill.support.test$ psql -U nitro -d craftcms -f ./database.sql
psql: FATAL:  Peer authentication failed for user "nitro"

Similar issue in Homestead that's been around for ages: laravel/homestead#1338 but their workaround is already in place on our pg_hba.conf file, so it must be something different.

Recommend setup for front end complexities like HMR

This may be a non-issue, but my DDEV/Docker setup has been tricky at times with front end testing (Codeception browser tests, Jest) and webpack (specifically HMR), so even if it’s a documentation issue (!) it’ll be good to have some best practices and recommendations around how those things should work with a project running in a Nitro machine.

info command weirdness

If you have multiple VMs running and you run nitro info, it will only display the first VM.

You have to explicitly pass in --machine to see the 2nd VM's info.

Maybe nitro info should return all VM's by default and if you want just one, pass in the --machine flag?

Or maybe once https://github.com/pixelandtonic/nitro/issues/45 is implemented, and it's in the context of a project, it returns just that project's info unless you pass in a --all?

alternatively, vagrant has a status to get a per-project status and separate global-status to get all project statuses, but not sure that's the best way.

[FR] database import command

Thinking of something like DDEV’s import-db, which without any arguments asks you to point to a database. Also supports a --src argument for the fast (non-interactive) lane.

Others mentioned adding a flag (maybe --support) that could parse the dump for the table prefix and adjust .env accordingly.

"add" response text

when using add, it has this as response text "sudo nitro --machine nitro-dev hosts craft3.support.test" -

hosts doesn't exist anymore

[FR] `nitro info` command

Single command for listing commonly-important (and unique) machine details.

Example:

nitro info

⚡️ running
Host IP Address: 0.0.0.0
Hostname(s): omgnitro.dev
MySQL: 
- username `root` 
- password `extrasecure`
- port 3306
MailHog UI: 0.0.0.0:8025

Use `nitro -h` for a full list of commands!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.