laravel / forge-cli Goto Github PK
View Code? Open in Web Editor NEWThe Laravel Forge CLI.
License: MIT License
The Laravel Forge CLI.
License: MIT License
Would be nice to be able to use a specific SSH key. We have about 30 servers in our Forge account and it's a bit cumbersome to add a specific Forge CLI key to every server, then multiply that with a couple of developers.
When we provision a new server SSH keys gets added for each developer and then we all can connect without adding the keys manually. Something like this perhaps:
$ forge server:current --key=my-key-that-is-added-to-all-servers.pub
Maybe I'm missing something, but I've read the docs and couldn't find an override.
Edit:
A thought would be to specify which keys to use in ~/.ssh/config
, but then again, we have a bunch of servers which would make that a bit fiddly
For our very small team's workflow, it would be helpful for anyone to be able to deploy any branch to the test server without needing to update the branch via the Forge web UI.
Something like:
forge deploy example.com feature-branch
This is maybe possible already by first using the Forge SDK and calling $site->updateGitRepository() before deployment, but would be nice to have it bundled in the Forge CLI.
Thanks for considering.
We use a non default ssh port for security reasons.
From hat I can see there is no way to change the ssh port at the moment?
Would be a nice feature.
i am managing a lot of sites (20+) on many servers and i find it a huge effort to manage my servers from the forge web dashboard.
this means that there are basically (20 + server amount) * configuration sections
different configuration pages in forge that need to be configured which is huge and hard to manage.
i also often need to clone a site (and server) for clients and i did not find a clone server/site option in forge. (maybe i missed it?)
so to fix this problem i thought of a better way to solve this: introduce .toml configuration files
this would basically solve all these issues because:
let me know what you think and if something like file-based configurations have been considered :)
1.8.0
8.1.26
In the recent integration between Laravel Forge and Envoyer, I've encountered a significant limitation. Once a site is connected with Envoyer through Forge, there's no provided option in the user interface or the Laravel Forge API to disconnect that project from Envoyer.
Expected Outcome:
An explicit option should be available to disconnect a project from Envoyer within the Laravel Forge interface or through its API. This functionality is crucial to provide a complete experience and allow for full management of the connection between these services.
Impact:
The lack of this option makes it difficult for users to handle connections between Forge and Envoyer in a complete and efficient manner. This missing functionality can be critical for projects needing adjustments in their integrations or temporary disconnections.
Additional Information:
This issue limits users' flexibility and control over their integrations between Laravel Forge and Envoyer. Adding a feature to disconnect projects would be beneficial for those needing to adjust their configurations or make changes in the connection between both platforms.
forge deploy site
Picking up from here, forge ssh:test
and other ssh commands are resulting in:
Unable to connect to remote server. Maybe run [ssh:configure] to configure an SSH Key?
Which I've already done for this server. I've reproduced this on two machines.
forge login
and add API key==> Creating Key [some_existing_server_slug.pub]
==> Adding Key [some_existing_server_slug.pub] With The Name [some-existing-server-slug] To Server [some-existing-server-slug]
==> SSH Key Based Secure Authentication Configured Successfully
forge ssh some-existing-server-slug
Unable to connect to remote server. Maybe run [ssh:configure] to configure an SSH Key?
forge server:current
. See you're in the context of the server you just configured SSH forforge ssh:test
. See:Unable to connect to remote server. Maybe run [ssh:configure] to configure an SSH Key?
I noted in the other issue that I wasn't clear how the system was deciding which SSH key to present and that some debugging was turning up Permission Denied errors, but it's been a while so I'm not 100% sure on any of that anymore.
When I deploy to the site, the deployment actually works and the site is deployed. Just a weird thing after that. I get an error, Unable to connect to the remote server. I have the connection working hence I can deploy.
forge deploy site
1.8.0
8.3.1
forge env:push api.signalspot.io .env.production
==> Uploading [.env.production] Environment File
An unexpected error occured. Please report this issue here:
https://github.com/laravel/forge-cli/issues/new/choose
Just trying to push env file
#1
($lastErrors) must be of type array, bool given, called in phar:///Users/nathanjames/.composer/vendor/laravel/After each command, I am receiving the error message above. The actual commands all seem to be working as expected (eg. I can run forge ssh
and get onto the server correctly, but they all show the below after running:
When running forge -h
, the error message does not display.
This was the first use of composer on this machine, if that has any relevance.
There's a high chance this is something specific to my machine, but thought it'd be better to report just in case.
I've downgraded to php8.1 and the error has dissapeared - so it's definitely an issue with php8.2 compatability
Following this, running even just forge
gives this error, as well as running any forge
command (e.g. forge server:current
and forge ssh
).
Please update the forge ssh CLI command to accept all ssh options:
https://man7.org/linux/man-pages/man1/ssh.1.html
And add the ability to do "--" at the end to take anything after "--" as run on the remote server
I have PHP 8.0.8 installed but the software tells me that it is required PHP 7.3. I checked the composer.json of the package for missing version declaration and noticed there is only one pipe in "^7.3|^8.0". Is this the problem?
Got an error while exiting the server
Enter exit
when logged into the server
Ran forge deploy [site] and got this error - the deployment did go ahead on Forge however.
==> Queuing Deployment
==> Waiting For Deployment To Start
==> Deploying
An unexpected error occured. Please report this issue here:
https://github.com/laravel/forge-cli/issues/new/choose
- Forge CLI Version: 1.4.0
- PHP Version: 8.1.7
- Operating System: Linux
- Error Message: array_map(): Argument #2 ($array) must be of type array, string given.
forge deploy example.com
Hope this helps! Much π for Forge
Is it possible to store the site configuration in the repository?
When I deploy customers sites (this happens often unfortunately) in the company i always have to configure all the fields in the forge interface instead of being able to copy from another project like you can do in vapor for example.
Is this possible or do we have to configure this every time in the forge panel?
Thanks!
An unexpected error occured. Please report this issue here:
https://github.com/laravel/forge-cli/issues/new/choose
I don't actually know what caused it to error. Standard forge setup, just doing a deploy and it threw this error with no error message. Fully understand if you'd like to just close this issue, due to lack of information, but I wanted to report it, just in case its useful.
forge deploy {site}
1.8.0
8.2.12
Retrieving The List Of Servers
An unexpected error occured. Please report this issue here:
https://github.com/laravel/forge-cli/issues/new/choose
forge server:list
$ forge
Using PHP 8.0.9
PHP is using the following php.ini file:
/opt/homebrew/etc/php/8.0/php.ini
Checking Box requirements:
E.
[ERROR] Your system is not ready to run the application.
Instructions as on forge cli website : composer global install laravel/forge-cli
forge
An unexpected error occured. Please report this issue here:
https://github.com/laravel/forge-cli/issues/new/choose
forge daemon:restart
It would be amazing if there could be a single file like the vapor.yml for Forge (like a forge.yml) so you can have a single configuration file with all the settings that can even be copied to other sites. This would make Forge server managing so much easier and faster for us. Have you thought about this feature?
Hey guys!
We have our Laravel application in a self-hosted GitLab. Here we want to trigger the deployment via Forge in a CI job. The CI instance that runs Forge CLI needs SSH access to the server. However, this is not easily possible for us/Only associated with great effort. Nevertheless, the message "Unable to connect to remote server. Maybe run [ssh:configure] to configure an SSH key?" appears, the deployment starts and runs successfully. We just don't get any current deployment logs -which we don't need anyway.
Now the question is, if it's useful to extended the CLI tool and introduce sth. like forge deploy mylittlepony.com --no-ssh
. This command would start the deployment and then "only" checks whether the deployment has run successfully or not. Without any displayed logs.
Maybe the API of Forge has to be extended so that the current state of a deployment can be returned. But of course we do not know if this is possible at all. Currently it does not look like the API offers this functionality. (See: https://forge.laravel.com/api-documentation#deploy-now). However, we can see the status of a deployment in the UI (Deploying, Finished, Failed). So maybe the API could also provide this information?
What do you guys think about this?
As of now there is no way to log in as an isolated PHP user using the Forge CLI, as there is no option to select the SSH user on the fly. It would be great to override the "forge" user by doing something like: forge ssh mywebserver --user=examplecom
, as the forge user doesn't have permissions to edit files for isolated users, naturally. I could of course su
..
1.8.0
8.2.15
Authentication works, but commands after auth are forbidden
When running forge login
and am greeted with ==> Authenticated Successfully As [email protected]
I then ran forge site:list
and get Forbidden.
Hello,
on Windows Environments (whos using Windows wtf?) tested on two different machines
PHP 8.x installed per chocolatey package manager Curl errors occure on every Forge Curl Request.
In CurlFactory.php line 211:
cURL error 60: SSL certificate problem: unable to get local issuer certificate (see https://curl.haxx.se/libcurl/c/libcurl-errors.htm
l) for https://forge.laravel.com/api/v1/user
To fix this error you have to configure the curl pem certificates in your php.ini
https://stackoverflow.com/questions/29822686/curl-error-60-ssl-certificate-unable-to-get-local-issuer-certificate
Im no curl expert but maybe the requests have to be started with different params or the root certificate can be integrated into the cli ?
Windows Build Number:
21H1 19043.1110
forge daemon:logs --tail # Visualize logs in realtime
I think this should be named as --follow
or -f
to match tail
s syntax?
Tried to use forge login with forge api token from windows system, but got errors:
An unexpected error occured. Please report this issue here:
https://github.com/laravel/forge-cli/issues/new/choose
Please let me know how to fix it.
Thanks!
Hi,
I have been using BeyondCodes forge-cli package before and they have 2 very useful features that would definitely enhance this package:
This is the link to the repository: https://github.com/beyondcode/forge-cli
Is this something that is planned or you are open to add to this CLI package?
I am experiencing an error when I try to view my site logs via the CLI.
I have authenticated properly, and the SSH is working too.
The error message I'm getting is strtolower(): Passing null to parameter #1 ($string) of type string is deprecated.
Run the command to list site logs:
forge site:logs [my_site_name.com]
I'm getting a lot of intermittent SSH connectivity issues and some of the commands do not seem to be working properly, maybe as a result of the SSH issues.
SSH issues first:
I am following the Forge CLI docs and have made sure to configure my SSH keys, and I have verified that they are indeed on the server.
I run ssh:test
once, which seems to work. But then I run the command 30 seconds later and it now claims I do not have SSH keys configured:
https://i.imgur.com/UWKRRPV.png
This has been happening for hours ever since I downloaded Forge CLI.
In addition, most of the commands are not working properly, I assume because of the connectivity issues:
https://i.imgur.com/Db8uYd7.png
This is one example, using the site:logs
command, but the same inconsistencies can be seen with the 'site:deploy' command, basically anything that I imagine requires an SSH.
Unfortunately I am not able to provide reproduceable steps as this seems to be some weird ephemeral bug that nobody else is able to really help with.
OS: Mac 11.5.1 (Intel)
CLI Version: 0.1.2
PHP Version: 7.4
Target server PHP version: 7.4
Command: forge deploy
(interactively)
Steps:
Run command
Typed out site id from list
Saw Queueing, Waiting, and Deploying.
Received:
strpos(): Empty needle in RemoteRepository.php line 121
Expected:
Deploy steps and a success
FWIW, the deploy finished/completed on the server.
I wanted to give forge-cli a try. I installed it globally, grabbed an api token, then tried forge login
. I got the following error
forge login
1.0.8
8.2.7
After put
forge login
later put TOKEN, give this error
An unexpected error occured. Please report this issue here:
https://github.com/laravel/forge-cli/issues/new/choose
forge login
TOKEN
There is no way i can list files inside my site. I needed to my site directory and delete a file or copy file. It will be nice to be able to list the files directory for each site
I have my site setup in /home/forge/site.name.com/current
which is a symlink to a release folder.
forge tinker
does not check for this convention.
It would be awesome if the forge ssh
command took into account the isolated system user account rather than assuming forge
.
Is that something youβd consider adding?
Perhaps this is outside the scope of the Forge CLI, but being able to create a site via the command line would be very useful. For instanceβ
forge site:create
--server=serverId
--domain=example.com
--alias=example.org
--alias=another-site.net
--phpversion=8.0
--directory=/public
1.8.0
8.1.26
In the recent integration between Laravel Forge and Envoyer, I've encountered a significant limitation. Once a site is connected with Envoyer through Forge, there's no provided option in the user interface or the Laravel Forge API to disconnect that project from Envoyer.
Steps to Reproduce:
Expected Outcome:
An explicit option should be available to disconnect a project from Envoyer within the Laravel Forge interface or through its API. This functionality is crucial to provide a complete experience and allow for full management of the connection between these services.
Impact:
The lack of this option makes it difficult for users to handle connections between Forge and Envoyer in a complete and efficient manner. This missing functionality can be critical for projects needing adjustments in their integrations or temporary disconnections.
Additional Information:
This issue limits users' flexibility and control over their integrations between Laravel Forge and Envoyer. Adding a feature to disconnect projects would be beneficial for those needing to adjust their configurations or make changes in the connection between both platforms.
This is related to a couple of similar issues I have seen - namely #16 and #18
I am using Forge CLI v.1.4 on Ubuntu MATE 21.04. I am able to connect to machine manually via ssh and all is okay. The command proposed in issue #18: ssh -o "IdentitiesOnly=yes" -i ~/path/to/key forge@SERVER_IP
also works for me but when using forge ssh:test
I get Unable to connect to remote server. Maybe run [ssh:configure] to configure an SSH Key?
. When I deploy, with forge deploy
. deployment is fine - i.e. it happens and the Forge UI records it appropriately however, the process disconnects with this error. Out of interest, I ran forge ssh:test -vvv
which records an execption:
me@machine:/var/www/mysite/dev$ forge ssh:test -vvv
Box Requirements Checker
========================
> Using PHP 8.0.18
> PHP is using the following php.ini file:
/etc/php/8.0/cli/php.ini
> Checking Box requirements:
β The application requires the version "^8.0" or greater.
β The application requires the extension "zlib".
[OK] Your system is ready to run the application.
==> Establishing Secure Connection
In Application.php line 124:
[LaravelZero\Framework\Exceptions\ConsoleException]
Unable to connect to remote server. Maybe run [ssh:configure] to configure an SSH Key?
Exception trace:
at phar:///home/me/.config/composer/vendor/laravel/forge-cli/builds/forge/vendor/laravel-zero/framework/src/Application.php:124
LaravelZero\Framework\Application->abort() at phar:///home/me/.config/composer/vendor/laravel/forge-cli/builds/forge/vendor/laravel-zero/foundation/src/Illuminate/Foundation/helpers.php:44
abort() at phar:///home/me/.config/composer/vendor/laravel/forge-cli/builds/forge/vendor/laravel-zero/foundation/src/Illuminate/Foundation/helpers.php:64
abort_if() at phar:///home/me/.config/composer/vendor/laravel/forge-cli/builds/forge/app/Repositories/RemoteRepository.php:176
App\Repositories\RemoteRepository->App\Repositories\{closure}() at phar:///home/me/.config/composer/vendor/laravel/forge-cli/builds/forge/vendor/spatie/once/src/functions.php:40
once() at phar:///home/me/.config/composer/vendor/laravel/forge-cli/builds/forge/app/Repositories/RemoteRepository.php:177
App\Repositories\RemoteRepository->ensureSshIsConfigured() at phar:///home/me/.config/composer/vendor/laravel/forge-cli/builds/forge/app/Commands/SshTestCommand.php:44
App\Commands\SshTestCommand->handle() at phar:///home/me/.config/composer/vendor/laravel/forge-cli/builds/forge/vendor/illuminate/container/BoundMethod.php:36
Illuminate\Container\BoundMethod::Illuminate\Container\{closure}() at phar:///home/me/.config/composer/vendor/laravel/forge-cli/builds/forge/vendor/illuminate/container/Util.php:41
Illuminate\Container\Util::unwrapIfClosure() at phar:///home/me/.config/composer/vendor/laravel/forge-cli/builds/forge/vendor/illuminate/container/BoundMethod.php:93
Illuminate\Container\BoundMethod::callBoundMethod() at phar:///home/me/.config/composer/vendor/laravel/forge-cli/builds/forge/vendor/illuminate/container/BoundMethod.php:37
Illuminate\Container\BoundMethod::call() at phar:///home/me/.config/composer/vendor/laravel/forge-cli/builds/forge/vendor/illuminate/container/Container.php:653
Illuminate\Container\Container->call() at phar:///home/me/.config/composer/vendor/laravel/forge-cli/builds/forge/vendor/illuminate/console/Command.php:136
Illuminate\Console\Command->execute() at phar:///home/me/.config/composer/vendor/laravel/forge-cli/builds/forge/app/Commands/Command.php:103
App\Commands\Command->execute() at phar:///home/me/.config/composer/vendor/laravel/forge-cli/builds/forge/vendor/symfony/console/Command/Command.php:291
Symfony\Component\Console\Command\Command->run() at phar:///home/me/.config/composer/vendor/laravel/forge-cli/builds/forge/vendor/illuminate/console/Command.php:121
Illuminate\Console\Command->run() at phar:///home/me/.config/composer/vendor/laravel/forge-cli/builds/forge/vendor/symfony/console/Application.php:989
Symfony\Component\Console\Application->doRunCommand() at phar:///home/me/.config/composer/vendor/laravel/forge-cli/builds/forge/vendor/symfony/console/Application.php:299
Symfony\Component\Console\Application->doRun() at phar:///home/me/.config/composer/vendor/laravel/forge-cli/builds/forge/vendor/symfony/console/Application.php:171
Symfony\Component\Console\Application->run() at phar:///home/me/.config/composer/vendor/laravel/forge-cli/builds/forge/vendor/illuminate/console/Application.php:102
Illuminate\Console\Application->run() at phar:///home/me/.config/composer/vendor/laravel/forge-cli/builds/forge/vendor/laravel-zero/foundation/src/Illuminate/Foundation/Console/Kernel.php:129
Illuminate\Foundation\Console\Kernel->handle() at phar:///home/me/.config/composer/vendor/laravel/forge-cli/builds/forge/vendor/laravel-zero/framework/src/Kernel.php:95
LaravelZero\Framework\Kernel->handle() at phar:///home/me/.config/composer/vendor/laravel/forge-cli/builds/forge/forge:36
require() at /home/me/.config/composer/vendor/laravel/forge-cli/builds/forge:14
include() at /home/me/.config/composer/vendor/bin/forge:117
ssh:configure
forge ssh:test
or forge deploy
Trying to connect to Laravel forge via CLI fails on both forge login
and forge login --token=MY_PERSONAL_TOKEN
producing the following error:
An unexpected error occurred. Please report this issue here:
https://github.com/laravel/forge-cli/issues/new/choose
- Forge CLI Version: 1.3.4
- PHP Version: 8.0.11
- Operating System: WINNT
- Error Message: cURL error 60: SSL certificate problem: unable to get local issuer certificate (see https://curl.h
axx.se/libcurl/c/libcurl-errors.html) for https://forge.laravel.com/api/v1/servers.
forge login
produces this aforementioned error.
1.8
8.2
An unexpected error occured. Please report this issue here:
https://github.com/laravel/forge-cli/issues/new/choose
composer require laravel/forge
forge login
I am trying to run Forge CLI but get an error message that I am not running a higher version than PHP 7.3 but I'm running it with PHP 8.0.6.
Box Requirements Checker
========================
> Using PHP 8.0.6
> PHP is using the following php.ini file:
/usr/local/etc/php/8.0/php.ini
> Checking Box requirements:
E.
[ERROR] Your system is not ready to run the application.
Fix the following mandatory requirements:
=========================================
* The application requires the version "^7.3" or greater.
1.7.0
8.2.0
I downloaded the latest version of Forge CLI.
I ran the command: forge login
Responds: Please Enter Your Forge API Token:
I enter my token that I get from: https://forge.laravel.com/user-profile/api
This following message shows:
`
An unexpected error occured. Please report this issue here:
https://github.com/laravel/forge-cli/issues/new/choose
Get API key from: https://forge.laravel.com/user-profile/api
Download latest version of Forge CLI.
Run command: forge login
Enter API key.
1.8.0
8.0.28
Latest minor version removed support for php 8.0:
laravel/forge-cli[v1.7.0, ..., v1.8.0] require php ^8.1.0 -> your php version (8.0.28) does not satisfy that requirement.
I would consider this a braking change and to either bump major version number og fix braking change.
Try installing globally through Composer on any setup with php 8.0 installed.
Fatal error. VSCode automatically opened laravel\forge-cli\scripts\keysFactory.php
.
forge ssh:configure
0
to create new keyAn unexpected error occured. Please report this issue here:
https://github.com/laravel/forge-cli/issues/new/choose
- Forge CLI Version: 1.1.0
- PHP Version: 7.4.20
- Operating System: Darwin
- Error Message: Failed to deploy. Please refresh the tokens in your Forge profile..
Change the branch name on Github without updating the branch name at Forge, then try to deploy. The error message could if possible be more specific rather than Please refresh the tokens in your Forge profile..
.
When using forge ssh:configure
I get an error. After selecting the server, creating a new key and naming it I get Error Message: Trying to access array offset on value of type null.
forge ssh:configure
server id
0 (create new key)
ssh key name
Then error shows
1.8.0
8.2.9
Encountered an array_map()
error in Forge CLI version 1.8.0 when trying to deploy a website using the forge deploy
command.
Expected the website to deploy without errors.
Received an error message stating:
array_map(): Argument #2 ($array) must be of type array, string given.
The issue appears consistently when attempting to deploy using the forge deploy
command.
forge deploy [WEBSITE_NAME]
to deploy a website.array_map()
error.Somehow running commands via the Forge CLI got out of sync with the results from the server, and as such every subsequent command returns the output from the previous command. The output looks fine when viewing commands on the Forge website, it's only the commands through the CLI.
I'm guessing it's running the command and then returning the last command execution output, and somehow one of the previous commands failed, causing it to have the previous command output in the queue to be returned. It seems to be a problem somewhere on Forge's side. I can't see any local directory on my system or the servers that contain the output, and it is affecting all of my servers that I've tested with.
I don't know what caused it, but you can see it in action here:
valorin@Eowyn:~/dev/wevsite (main * u=)$ forge command withextraveg.net --command="php artisan env"
==> Queuing Command
==> Waiting For Command To Run
==> Running
Event unresolvable.
valorin@Eowyn:~/dev/wevsite (main * u=)$ forge command withextraveg.net --command="php artisan env"
==> Queuing Command
==> Waiting For Command To Run
==> Running
β Current application environment: production
==> Command Run Successfully.
valorin@Eowyn:~/dev/wevsite (main * u=)$ forge command withextraveg.net --command="php artisan list"
==> Queuing Command
==> Waiting For Command To Run
==> Running
β Current application environment: production
==> Command Run Successfully.
Note that I ran the artisan env
command twice, and the initial time it failed, with the two subsequent command executions returning the output from artisan env
, with the output from artisan list
not being displayed.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.