GithubHelp home page GithubHelp logo

Comments (7)

shrink avatar shrink commented on April 28, 2024

The best way that I've found to do this is to define your own "setup" command within your composer configuration, then encourage people to run that command after cloning your project instead of composer install. For example, a command named setup might do the following:

  1. Install all the composer dependencies
  2. Copy the configuration file
  3. Set up the Homestead environment
  4. Generate the application key
  5. ??? Anything else you need

And you can create such a command in your composer.json like so:

"scripts": {
    "post-install-cmd": [
        "php artisan clear-compiled",
        "php artisan optimize"
    ],
    "pre-update-cmd": [
        "php artisan clear-compiled"
    ],
    "post-update-cmd": [
        "php artisan optimize"
    ],
    "setup": [
        "composer install",
        "php -r \"copy('.env.example', '.env');\"",
        "php vendor/bin/homestead make --ip=192.168.10.32",
        "sed -i '' 's/homestead.app/pterodactyl.local/g' Homestead.yaml",
        "php artisan key:generate"
    ]
}

Then someone might do the following:

$ git clone https://github.com/Pterodactyl/Panel.git
$ composer setup

After that command has ran they'll be ready to go, no other set up required, which is ideal

That's the best way I've uncovered so far, I'll update this issue if I ever find something better. Unfortunately it's not possible to do this automatically on composer install because there's no "on first composer install" event, but there's no danger to someone running composer install and then composer setup after so... this method is almost perfect.

Also, minor note, using .app is bad -- unsure why Laravel encourages this. The .app gtld is owned by Google and may eventually be put into use, rendering development links broken. .local is reserved (via wikipedia) so it shouldn't be a risk to use .local during development.

from panel.

DaneEveritt avatar DaneEveritt commented on April 28, 2024

Thanks for the note about .app, I was unaware of that. I like the idea of using a setup command as well. It might be possible to use post-create-project-cmd, although I haven't looked into it closely.

from panel.

shrink avatar shrink commented on April 28, 2024

unfortunately the post-create-project-cmd event is only fired when you first create a project via composer (composer create-project --prefer-dist laravel/laravel), so it's not a viable option. There is no event -- as far as I can find -- that is fired after the first composer install.

from panel.

DaneEveritt avatar DaneEveritt commented on April 28, 2024

Yeah, it seems like having a custom setup command is the way to go. I could potentially include a separate bash script that the install calls each time that checks if it has ready been run, but that is excessive. Plus, if it is its own command they can always redeploy if for some reason it is needed.

from panel.

shrink avatar shrink commented on April 28, 2024

Discovered that the command included for changing the hostname in the Homestead configuration won't work cross platform. Essentially sed does not have a cross platform way to rename in place without a backup file (Stackoverflow discussion of the problem here). The cross platform solution is to enable the backup file and then remove it after, so the command looks like:

sed -i.bak 's/homestead.app/pterodactyl.local/g' Homestead.yaml && rm Homestead.yaml.bak

from panel.

DaneEveritt avatar DaneEveritt commented on April 28, 2024

Still need to provide documentation for editing their hosts file as well, I could echo it in probably, but that would require sudo privileges.

from panel.

DaneEveritt avatar DaneEveritt commented on April 28, 2024

I probably should have a setup-dev and setup command, but I'll come back to that when we figure out how we will be shipping the final panel.

from panel.

Related Issues (20)

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.