Giter VIP home page Giter VIP logo

larasail's Introduction

LaraSail

LaraSail is a CLI tool for Laravel to help you sail the servers of the DigitalOcean.


You'll need a DigitalOcean account before getting started (Signup here), then you'll need to create a New Droplet. Make sure to select Ubuntu Server:

Installation

SSH into your server and run the following command:

curl -sL https://github.com/thedevdojo/larasail/archive/master.tar.gz | tar xz && source larasail-master/install

You can make sure it's installed by running:

larasail -h

Setup your server

larasail setup

The default configuration will install Nginx, PHP 8.2, and MySQL 8. If you wish to use PHP 7.1, 7.2, 7.3, 7.4, 8.0, 8.1 or 8.3 you can include the argument php71/php72/php73/php74/php80/php81/php83 like so:

larasail setup php71 # Install with PHP 7.1
larasail setup php72 # Install with PHP 7.2
larasail setup php73 # Install with PHP 7.3
larasail setup php74 # Install with PHP 7.4
larasail setup php80 # Install with PHP 8.0
larasail setup php81 # Install with PHP 8.1
larasail setup php83 # Install with PHP 8.3

Database

By default, LaraSail will set up the latest version of MySQL. To opt for MariaDB instead, kindly pass mariadb to larasail setup as the second or third parameter like so:

larasail setup mariadb # will install default PHP version (7.4) and MariaDB
larasail setup php80 mariadb # will install the selected PHP version (8.0 in this case) and MariaDB
larasail setup mariadb php80 # same as above

Redis

By default, LaraSail does not install a Redis server. To opt to install redis, pass redis option to larasail setup as the second or third parameter like so:

larasail setup php82 redis

or

larasail setup redis

Creating a new site

✨ Automatically

Laravel

After setting up the server you can create a new project by running:

larasail new <project-name> [--jet <livewire|inertia>] [--teams] [--www-alias]

This will automatically create a project folder in /var/www and set up a host if the provided project name contains periods (they will be replaced with underscores for the directory name). By default, LaraSail sets up the Nginx site configuration and Let’s Encrypt SSL certificate for your domain. If you would like both the www alias and root domain setup (i.e. example.com and www.example.com) kindly pass the --www-alias flag.

Wave

Wave - The Software as a Service Starter Kit, designed to help you build the SAAS of your dreams. 🚀 💰 LaraSail allows you to create a new Wave project automatically by adding --wave flag to the new command as follows:

larasail new <project-name> [--wave]

Just like Laravel above, this will create a project folder, setup the Nginx site configuration and Let’s Encrypt SSL certificate for your domain. By default, you will be prompted to create a project database and if successful, will migrate and seed the database.

🚧 Manually

Alternatively, you can clone a repository or create a new Laravel app within the /var/www folder:

cd /var/www && laravel new mywebsite

If you want to include Laravel Jetstream into your project, you need to specify the --jet option:

cd /var/www && laravel new mywebsite --jet

Then, you'll need to setup a new Nginx host by running:

larasail host mywebsite.com /var/www/mywebsite --www-alias

larasail host accepts three parameters:

  1. Your website domain (mywebsite.com)
  2. The location of the files for your site (/var/www/mywebsite/public)
  3. Optional flag if you would like to include your project's www alias: www.mywebsite.com (--www-alias)

Finally, point your domain to the IP address of your new server. And wallah, you're ready to rock 🤘 with your new Laravel website. If you used the --www-alias flag, don't forget to add your domain's www CNAME record

Passwords

When installing and setting up LaraSail there are two passwords that are randomly generated:

  1. The password for the larasail user created
  2. The default MySQL password

To get the larasail user password you can type in the following command:

larasail pass

And the password for the larasail user will be displayed. Next, to get the default MySQL root password you can type the following command:

larasail mysqlpass

And the MySQL root password will be displayed.

Creating a database

After you have created your project you can create a database and user for it by using the following command:

larasail database init [--user larasail] [--db larasail] [--force]

By default it will create a database and the user larasail and grant all permissions to that user.

TIP: If you are in the project directory when you run this command, it will also try to update the .env file with the newly generated credentials.

After you have created a database, you can show the newly generated passwords using the following command:

larasail database pass

Switching to the larasail user

When you SSH into your server you may want to switch users back to the larasail user, you can do so with the following command:

su - larasail

Make sure to star this repository and watch it for future updates. Thanks for checking out LaraSail. ⛵

Contributing

If you are contributing, please read the contributing file before submitting your pull requests.

larasail's People

Contributors

aldimx avatar bobbyiliev avatar fumblehool avatar lexuzieel avatar owenvoke avatar raphaelstolt avatar samuelmwangiw avatar tnylea avatar ttiger 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

larasail's Issues

Oh dear god, why?

...can't software developers write readable instructions?
IMHO, every tech company should employ humanities scholars like me to write actual instructions for actual people. Please, image you didn't build it and don't know how it works, and start to explain it from that mindset.

Feature: Update Php Version

Update Php Version

For laravel 9 and newer versions you need php version 8.1 or newer, otherwise it is often incompatible and can cause errors when deploying.

Feature: Use MariaDB in place of mysql

Is your feature request related to a problem?

Inspired by #59
It would be really awesome to have the choice to install MariaDB instead of MySQL.

Describe the solution you'd like

Just like php, among the options for mysql Version, have a mariadb option that installs the latest version of MariaDB.

Describe alternatives you've considered

MySQL is the default option. I run MariaDB 10.5 in production. It would be nice to have the option

Additional context

Not sure if the option would be helpful to anyone else besides myself?

Bug: `laravel` is not available in $PATH on Ubuntu 20.04 (LTS) x64

Describe the bug

After installing larasail and running larasail setup I tried executing the next step:

cd /var/www && laravel new mywebsite

which in turn printed:

laravel: command not found

To Reproduce

  1. Create Ubuntu 20.04 (LTS) x64 droplet on Digital Ocean
  2. Install larasail
  3. Try executing laravel under larasail user

Expected behavior

Global command larasail works

Screenshots

Context

Checking $PATH variable I found that /home/larasail/.composer/vendor/bin is actually present, however the directory itself is missing.

Proposed solution

Use composer create-project --prefer-dist laravel/laravel <project-name> instead (reference)

Discussion: Certbot PPA has been DEPRECATED

As per the the official launchpad description https://launchpad.net/~certbot/+archive/ubuntu/certbot and the following blocking prompt, the ppa has been deprecated.

image

As per eff instructions (https://certbot.eff.org/lets-encrypt/ubuntufocal-nginx), the recommended installation method is as a snap package. I would personally never run snapd on a server just to install certbot and would sometimes opt to run the outdated version found in the official packages (https://packages.ubuntu.com/focal/certbot: currently at version 0.40 while the latest certbot release is version 1.2) but wanted to get the community input on this one.

@bobbyiliev what's your thoughts?

Help: certbot auto renew SSL certs?

Does Larasail setup certbot to auto renew SSL certifications?

If not, what is the best way to set this up? I have read different methods.

https://eff-certbot.readthedocs.io/en/stable/using.html#setting-up-automated-renewal says to run:

SLEEPTIME=$(awk 'BEGIN{srand(); print int(rand()*(3600+1))}'); echo "0 0,12 * * * root sleep $SLEEPTIME && certbot renew -q" | sudo tee -a /etc/crontab > /dev/null

https://www.nginx.com/blog/using-free-ssltls-certificates-from-lets-encrypt-with-nginx/ says:

$ crontab -e and add
0 12 * * * /usr/bin/certbot renew --quiet

Thanks in advance,

How to get larasail credentials after I mistakenly closed the terminal?

Hey, excellent work by you. The installation was as smooth as sailing in the ocean. Truly, great stuff. Thanks alot for this.

Though, I messed up, rather forgot to get the larasail credentials before closing/exiting the terminal? I can ssh as root, but how do I get those credentials now? :(

Can’t connect to MySQL using generates random password.

Hi, I have installed this package and all working except the MySQL. I’m trying to login to database using command “mysql-u root -p” and enter the generated password from “larasail mysqlpass” but always denied.

I think I have missed something but I don’t know what’s that. Anyone can help?

www. alias is not setup

Describe the bug

How can I verify that '--www-alias' has worked?

The www. domain to my site doesn't appear to work. I added '--www-alias' when running larasail host.

No SSL is setup for the www. domain and it displays the nginx page when accessed (rather than my site).

https://testing.cjs-web.co.uk - works
http://www.test.cjs-web.co.uk - displays nginx page

I setup a CNAME record as follows:
image

I have a Laravel site in a Bitbucket repo, using Larasail to setup a Digital Ocean droplet.

To Reproduce

The commands I ran on my droplet:

curl -sL https://github.com/thedevdojo/larasail/archive/master.tar.gz | tar xz && source larasail-master/install

larasail setup php74

cd /var/www && git clone https://[email protected]/myusername/myrepo.git

composer install
cp .env.example .env
php artisan key:generate

larasail host myrepo.mydomain.co.uk /var/www/myrepo--www-alias

Bug: Node 15 is deprecated

Describe the bug

During installation, the following warning is presented:

DEPRECATION WARNING                            

  Node.js 15.x is no longer actively supported!

  You will not receive security or critical stability updates for this version.

  You should migrate to a supported version of Node.js as soon as possible.
  Use the installation script that corresponds to the version of Node.js you
  wish to install. e.g.

   * https://deb.nodesource.com/setup_12.x — Node.js 12 LTS "Erbium"
   * https://deb.nodesource.com/setup_14.x — Node.js 14 LTS "Fermium" (recommended)
   * https://deb.nodesource.com/setup_16.x — Node.js 16 "Gallium"

To Reproduce

Run the following:

larasail setup

Expected behavior

Install a supported npm version

Screenshots

image

Desktop

Test run in docker but the error can be replicated in any supported debian-based OS:

  • OS: docker
  • Version: ubuntu:20.04

Smartphone

N/A

Additional context

Recommended to update the script to install LTS (npm v14) or latest (npm v16)

Help: Create database, access denied root

when trying to create a database

use larasail database init --force

Additional context

larasail@mywebsite:~$ larasail database init --force
Please enter database user to create [larasail]: mywebsite
Please enter database name to create [larasail]: mywebsite
WARNING: This will remove existing database and user!
Are you sure? [y/N] y
ERROR 1698 (28000): Access denied for user 'root'@'localhost'
ERROR 1698 (28000): Access denied for user 'root'@'localhost'
ERROR 1698 (28000): Access denied for user 'root'@'localhost'
ERROR: Unable to create database 'mywebsite' (possible duplicate)
INFO: You can force new database creation with the same name by using --force flag

Discussion: Set php 8.0 as the Default

Is your feature request related to a problem? Please describe.

Am opening a discussion here on whether it makes sense to set php 8.0 as the default in time for Laravel 9's release scheduled for January 25th, 2022. Related to this, might want to opinions on whether Larasail should continue supporting 7.1 and 7.2 beyond 2022

Describe the solution you'd like

Tag a release with 7.4 as the default, add setup instructions in the README and switch to 8.0 from the new year going forward.

Describe alternatives you've considered

Status quo

Additional context

Following the release of PHP 8.1, version 7.3 will be going immediately out of life.
Version 7.4 on the other hand will cease active development and shall only receive security patches for the next few months.
Symphony 6 which came out last month has a minimum requirement of php8.0 and Laravel 9 which shall be coming out next month will also require >=8.0.

Nope

This did not work at all. I tried all everything, and nothing worked. Thanks for trying. This looked promising, but I guess it is back to the drawing board for me.

in ubuntu 20.04 LTS automatic installation of certbot will fail

Description

when executing larasail setup in ubuntu 20.04 LTS machine, the installation will finish with certbot installation error

Error

Hit:7 http://ppa.launchpad.net/ondrej/php/ubuntu focal InRelease               
Err:8 http://ppa.launchpad.net/certbot/certbot/ubuntu focal Release            
  404  Not Found [IP: 91.189.95.83 80]
Reading package lists... Done                                                  
E: The repository 'http://ppa.launchpad.net/certbot/certbot/ubuntu focal Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package python-certbot-nginx is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
  python3-certbot-nginx

E: Package 'python-certbot-nginx' has no installation candidate

Fix

It can be easily fix by running sudo apt install python3-certbot-nginx

Expected Result

It would be better if it can install python3-certbot-nginx automatically and also sudo apt install unzip since composer may need unzip library to run properly.

how to run laravel project without domain

i have came phase about specifying domain name, but i dont want to specify a domain name, i want to open my project with IP like 5555.555.555 or 5555.555.555/project

How can i do ?

Support for Ubuntu 18.04?

There is weird problem with ubuntu 18.04 after larasail setup . It works well in ubuntu 16.04 but i guess many people will use 18.04

Thanks :)

curl isn't working on a new droplet

I've tried installing 2 brand new droplets (to confirm I didn't make any errors the first time) as described on DevDojo.com, but once I enter the initial curl command and hit enter, it shows the larasail logo but stops after that and just shows a "$" prompt. Anything I enter here, even ls or any other basic commands return "command not found". I have to execute 'exit' to leave this mode.

Once I do hit exit, it brings me back to the initial (root@:~#) prompt that I land on when initially logging in.

Note: if i try running the curl command a 2nd time, it does note that 'useradd: user 'larasail' already exists'

Add redis support

Hello,

Most of Laravel applications use some queue for sending emails etc.
The most popular tools are Redis & Horizon.

Can you add option to setup supervisord + redis + horizon?
I will appreciate
Thx.

access mysql remotely on Windows

This is a great time-saving package,
I just cannot access to MySQL on windows .. I followed your video tutorial but I don't have sequel Pro and I tried with workbench but it didn't work.

Question

I already have a laravel project built and ready to deploy. Will this help me with that? I followed all of the steps and have no idea what to do now.

bugy

Is your feature request related to a problem? Please describe.

Describe the solution you'd like

Describe alternatives you've considered

Additional context

Feature: Add Git Repo in larasail new

Is your feature request related to a problem? Please describe.

It would be amazing to pass a git repository while initiating a new project. This would make it easy to provision a test environment for an existing app.

Describe the solution you'd like

For new repositories, --git parameter would be passed through to laravel new project --git.
If --repo (or repository) is passed, then a git clone is performed instead of `larasail new project.tld.

Alternatively, we can have a command different from new e.g deploy to avoid complicating new to support params such as --dev (can be used to determine if to --no-dev in composer install and determine the npm script to run)

Additional context

Every application environment is different to the next therefore this will be sufficient for everyone.
Would love to hear additional thoughts and if this is a desired feature in the first place.

Bug: create user with mysql_native_password error in MariaDB

Describe the bug

Running the following in MariaDB fails with the error shown below:

CREATE USER 'foo'@'%' IDENTIFIED WITH mysql_native_password BY 's3cur3b@r';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB 
server version for the right syntax to use near 'BY 's3cur3b@r'' at line 

To Reproduce

  1. setup larasail with MariaDB: larasail setup mariadb
  2. create new site: larasail new example.test
  3. attempt to initiate database: larasail database init

Expected behavior

A db and db user is created and the details populated in .env file but user creation fails in MariaDB

Screenshots

image

Additional context

When WITH mysql_native_password is deleted, both MySQL and MariaDB work fine.

-e "CREATE USER '$DATABASE_USER'@'%' IDENTIFIED WITH mysql_native_password BY '$DATABASE_PASSWORD';"

MariaDB knowledgebase also have a large warning discouraging direct use mysql_native_password and encourages the default ed25519. Not sure if the same advise applies to MySQL

It is not recommended to use the mysql_native_password authentication plugin for new installations that require high password security. If someone is able to both listen to the connection protocol and get a copy of the mysql.user table, then the person would be able to use this information to connect to the MariaDB server. The ed25519 authentication plugin is a more modern authentication plugin that provides simple password authentication using a more secure algorithm.

Feature: Add Support for php8.1

Is your feature request related to a problem? No

PHP 8.1 was recently released and it would be great to be able to use Larasail to provision a php 8.1 server for those of us who develop on the edge

Describe the solution you'd like

Ability to run:

larasail new php81

Describe alternatives you've considered

Installing php then manually upgrading to 8.1 may be an option but 🤷🏻‍♂️

Additional context

I will try work on a PR tonight

Feature: Option to ignore www.$domain

Is your feature request related to a problem? Please describe.

There are circumstances when the www.$domain is not necessary especially for subdomains e.g app.example.com. For such instances, it'd be amazing to have the option to setup nginx host and Letsencrypt only for the subdomain without necessary needing to add www.app.example.com CNAME. Not doing so, certbot fails during setup

Describe the solution you'd like

If sounds reasonable, am willing to work on a PR that adds an optional parameter whether to add the www.$domain in .larasail/host.

Describe alternatives you've considered

Always adding a www CNAME while setting up even when it's totally unnecessary.

Additional context

I hope the above is sufficient

Feature: Install Laravel Wave

Is your feature request related to a problem? Please describe.

As Laravel Wave is no opensource, it would be nice to have an option to install it via LaraSail.

Describe the solution you'd like

Add an argument to allow Laravel Wave installation rather than plain Laravel installation.

Question

I screwed up by opening a blank project with my actual domain name, and now when I start over it tells me the domain name already exists. Is it possible to delete the existing domain name and start over from scratch?
Screenshot 2020-07-14 at 12 49 07 PM

My-title

Describe the bug

To Reproduce

Expected behavior

Screenshots

Desktop

  • OS:
  • Browser:
  • Version:

Smartphone

  • Device:
  • OS:
  • Browser:
  • Version:

Additional context

authentication failure

after following instructions, and trying su - larasail, using the password given via larasail pass it fails.

also when trying to connect to the mysqli server it errors, am i doing something wrong?

Uninstall

How do I uninstall Larasail from my machine?

Apache2

Hello Guys,

Using LARASAIL to install a Server on DO, the apache2 server is being installed.
I think that it's necessary change the install command php7.2 to:
apt-get install php7.2-cli php7.2-fpm. This way will install only php without Apache Server.

I make a mistake to create a website on different folder and when I look on my browser came on a Apache Server Message... It Works..

Thanks for now.

Add support for Laravel Jetstream

Hi there,

With Laravel 8 out now, it will be nice to have an argument to install Laravel Jetstreamas well.

Hopefully, someone might be up for the challenge 🙌

Feature: Install npm during the initial setup

Is your feature request related to a problem? Please describe.

As npm is required by Jetstream, it would be nice to have it installed out of the box by LaraSail during the initial server setup.

Describe the solution you'd like

I think that using nvm would be a nice way to go as you can easily change the node versions at any time.

Other server providers

Hey,

just wondering if that would also work with other server providers such as Vultr, Linode, etc...?

Thank you!

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.