switchon@lavalamp.biz
+27(0) 83 419 4851 / +27(0) 21 036 1165
Application & software development
Get A Quote

    • Home
    • Services
      • Application & software development
      • Outsourced software development
      • Project based resourcing
      • Digital marketing & consulting
      • Graphic design & consulting
      • UI / UX design & consulting
      • Recruitment services
      • Lease an expert
    • About
      • How we work
      • NBConsult Group
      • Partners
      • Lightbox Digital
    • Blog
    • Join us
    • Contact

    • Home
    • Services
      • Application & software development
      • Outsourced software development
      • Project based resourcing
      • Digital marketing & consulting
      • Graphic design & consulting
      • UI / UX design & consulting
      • Recruitment services
      • Lease an expert
    • About
      • How we work
      • NBConsult Group
      • Partners
      • Lightbox Digital
    • Blog
    • Join us
    • Contact

    • Home
    • Services
      • Application & software development
      • Outsourced software development
      • Project based resourcing
      • Digital marketing & consulting
      • Graphic design & consulting
      • UI / UX design & consulting
      • Recruitment services
      • Lease an expert
    • About
      • How we work
      • NBConsult Group
      • Partners
      • Lightbox Digital
    • Blog
    • Join us
    • Contact

    • Home
    • Services
      • Application & software development
      • Outsourced software development
      • Project based resourcing
      • Digital marketing & consulting
      • Graphic design & consulting
      • UI / UX design & consulting
      • Recruitment services
      • Lease an expert
    • About
      • How we work
      • NBConsult Group
      • Partners
      • Lightbox Digital
    • Blog
    • Join us
    • Contact
    how to deploy a backend api to azure
    How To Deploy A Backend API To Azure
    Oct 7, 2019
    custom app colours in flutter
    Custom App Colours In Flutter
    Nov 8, 2019

    Provisioning A New Digital Ocean Server With Laravel Forge, And Deploying Code With Laravel Envoyer

    Categories
    • Software Development
    Tags
    • digital ocean
    • envoyer
    • forge
    • laravel
    • laravel envoyer
    • laravel forge
    • PHP
    • server
    laravel envoyer and forge
    laravel envoyer and forge

    Today I had to migrate a server for our client Xstream Connect from their hosting to our Digital Ocean droplet. Normally doing this is a pain, but with Laravel Forge and Envoyer, the process is quick and painless.

    If a team has been created on Digital Ocean you need to generate an API key. Navigate to Digital Ocean API Tokens and generate a new token. The name doesn’t really matter you can always edit it, but make sure the name at least describes where the token is going.

    Once the token is generated copy it and navigate to: Forge Providers

    Select Digital Ocean (2.0) as the provider, add in a Profile Name, and paste the copied API Token

    Then head to Forge Servers and click on the Digital Ocean icon:

    If you added a team through Digital Ocean, make sure that the credentials match the API Token you just created.

    Region
    The best server region for us in South Africa is London.

    Server Size
    The server size can be upgraded at later points (some things can’t be upgraded, so just make sure you’re selecting the correct server size by cross referencing Digital Ocean). A size of “2GB RAM – 1 CPU Core – 50GB SSD” is a fine for a few sites.

    MySQL version
    Any version here is fine, make sure it matches your needs though. I chose version 8.

    Database name
    This is just the default database, you can add this here, or wait until the server is provisioned to manage your databases and database users. I chose to wait, and manage the database once the server was provisioned.

    It can take a while to build a provision the server, maybe 2 to 10 minutes on average.

    While you’re waiting for the server to provision create a new project on Envoyer. Enter in the projects name, the type (typically Laravel 5/ 6/ Lumen). The only source control is Bit Bucket, the repo name should be {your bitbucket}/{your repo}.

    Hopefully by now the server has been provisioned. Make sure the connection is successful.

    In your Envoyer settings, navigate to the Integrations tabs, here you can add a Forge API token. In Forge, go to My Account -> API and create a new token. Copy and paste it into Envoyer. This links Forge and Envoyer, so you can just import the Forge server when viewing the project.

    Before doing that though, we need to add the site on Forge.

    The root domain is the domain name of your site, project type is General PHP/Laravel most of the time, but the web directory should be changed to “/current/public”. If it is not, Envoyer will be deploying to the wrong directory, and the site will not work.

    Once the site is added, you can head back to Envoyer and import the server using the Server name, and new Site name you just created.

    The connection might take a while to say successful, so just keep checking every minute or so.

    By default Forge servers don’t allow “username:password” based authentication. You need to add your public key to Forge. Under the SSH keys tabs, where you should see Envoyer having an active key, add a descriptive name, and your public key.

    Once that’s done, you should be able to SSH into the server using ssh forge@{the server’s IP address}

    Use your passphrase when prompted.

    To check everything has worked, deploy using Envoyer, and (using your terminal) navigate to {site-name}/current and see if your project files are there.

    Next step is your environment file. In. Envoyer, under the Servers tab there is a button to “Manage Environment”. If this is your first time clicking this button, the passphrase you enter will be set. Make sure to use a passphrase that you will remember. You can update the key if need be, but you need to remember it first.

    Paste in the contents of your .env file, and make sure everything is correct.

    For the database portion we need to create one:

    This is done easily through Forge on the Database link in the sidebar when viewing the server. I recommend adding a database user at the same time, it’s better to have users allowed to access one database only.

    To connect to the database you need to use SSH authentication. The MySQL host is the IP Address of the server, the username is forge, the password is the DB password you got when provisioning the server. The SSH host is the server’s IP address once again, SSH user is forge, and the SSH key should be your private key.

    All should be right, and you should be able to see your database you created in Forge.

    If all went right, you should be able to navigate to the site and have everything work.

    Contact us


      Related posts:

      implementing laravel echoImplementing Laravel Echo And Socket.io With A Laravel API And Ionic Vue App how to deploy your app/website on herokuHow To Deploy Your App/Website On Heroku how to send a tweet from within your angular app via node jsHow To Send A Tweet From Within Your Angular App Via Node Js laravel livewireLaravel Livewire
      Share
      23
      Gary Irwin
      Gary Irwin
      Gary is currently the CEO of Lava Lamp Lab, he has extensive experience in ICT Services & Business with global experience focusing on software and product development in emerging market. Working with High-calibre customers to deliver an array of B2B & Consumer Applications. Though Lava Lamp Lab, he leads multi-skilled teams in development & implementation of integrated IT solutions for companies through harnessing IoT (Internet of Things) , ML (Machine Learning) Platforms, Big Data / BI technologies. He consults on Application Modernization, Product Development, Ideation and Delivery Management of Solutions.

      Leave a Reply Cancel reply

      Your email address will not be published. Required fields are marked *

      Lava Lamp Lab


      Like technology, a lava lamp constantly changes form, producing new conditions with every passing moment



      lava lamp lab facebook   lava lamp lab twitter   lava lamp lab linkedin   lava lamp lab instgram

      Services


      Application & software development

      Outsourced software development

      Project based resourcing

      Digital marketing & consulting

      Graphic design & consulting

      UI / UX design & consulting

      Contact Us


      +27(0) 83 419 4851

      +27(0) 21 036 1165


      switchon@lavalamp.biz


      Unit 4 Monaco Square,
      14 Church Street,
      Durbanville,
      Cape Town, 7550

      NBConsult Group


      nbconsult
      nbconnect msp
      nbclearning
      river broadband
      designer needed
      © 2023 Lava Lamp Lab (Pty) Ltd | All Rights Reserved | Privacy Policy
      Contact us now

        Application & software development

          Outsourced software development

            Project based resourcing

              Digital marketing & consulting

                Graphic design & consulting

                  UI/UX design & consulting

                    Lease an expert

                      Recruitment services

                        We are using cookies to give you the best experience on our website.

                        You can find out more about which cookies we are using or switch them off in settings.

                        Lava Lamp Lab
                        Powered by  GDPR Cookie Compliance
                        Privacy Overview

                        This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.

                        Strictly Necessary Cookies

                        Strictly Necessary Cookie should be enabled at all times so that we can save your preferences for cookie settings.

                        If you disable this cookie, we will not be able to save your preferences. This means that every time you visit this website you will need to enable or disable cookies again.

                        3rd Party Cookies

                        This website uses Google Analytics to collect anonymous information such as the number of visitors to the site, and the most popular pages.

                        Keeping this cookie enabled helps us to improve our website.

                        Please enable Strictly Necessary Cookies first so that we can save your preferences!

                        Cookie Policy

                        More information about our Cookie Policy