PLATFORM
  • Tails

    Create websites with TailwindCSS

  • Blocks

    Design blocks for your website

  • Wave

    Start building the next great SAAS

  • Pines

    Alpine & Tailwind UI Library

  • Auth

    Plug'n Play Authentication for Laravel

  • Designer comingsoon

    Create website designs with AI

  • DevBlog comingsoon

    Blog platform for developers

  • Static

    Build a simple static website

  • SaaS Adventure

    21-day program to build a SAAS

Question By

Unsolved

Wave on Digital Ocean - Error 500

hserrouya

Jun 17th, 2024 07:31 AM

Hi, I just install Wave in Local. I tried to installed it to Digital Ocean, but I'm getting 500 error page. Is there a guide to install it correctly there?

Thanks

bobbyiliev

Jun 17th, 2024 07:36 AM

Hey 👋

Did you install this on a Droplet or the App Platform?

Usually the installation itself is the exact same as it would be for any other standard Laravel application. There should be no additional steps that you need to take.

The 500 error is just a generic error. To see the actual error that is causing the problem, you can check your laravel log at sotrage/logs/laravel.log. Feel free to share the exact error that you are getting here so I could advise you further.

- Bobby

hserrouya

Jun 17th, 2024 07:52 AM

Thanks, I got this error: production.ERROR: error connecting to database!(https://cdn.devdojo.com/images/june2024/download.png)

I use the app but in the installation, I didn't inserted database settings and .env is not in github.

Do you explain how to deploy it in one of your video?

ThanksScreenshot.png

bobbyiliev

Jun 17th, 2024 08:11 AM

Hey!

Yep, you would definitely need a database!

What you can do is to use the deploy button from the readme file:

After you commit those two changes, just click the button in the README file of your GitHub repo, or visit the deploy link directly:

https://cloud.digitalocean.com/apps/new?repo=https://github.com/YOUR_GH_USERNAME/wave/tree/main

That will create all of the necessary components for your app including a dev database.

Alternatively, you would just create a database via your DigitalOcean account:

https://docs.digitalocean.com/products/databases/

And then attach it to your App:

https://docs.digitalocean.com/products/app-platform/how-to/manage-databases/#add-a-database-to-an-app-using-the-control-panel

Note that you should not add your .env file to your Git repo as this is a huge security risk. With the app platform you manage your env variables directly though there rather than an env file.

Let me know if you have any questions.

- Bobby

hserrouya

Jun 17th, 2024 10:08 AM

Thanks, it is working.

But I got another problem using Voyager. When I'm creating a new BREAD, I create a model using command: php artisan make:model Mydocs and it is create the file at: App\Models\Mydocs.php

I'm getting the error: local.ERROR: Target class [App\Mydocument] does not exist. {"userId":1,"exception":"[object]

In a Voyager video i see that it create it in: App\Mydocs.php instead of: App\Models\Mydocs.php

Do you have an Idea? Thanks

bobbyiliev

Jun 17th, 2024 10:17 AM

Happy to hear that it is working :)

The error that you are getting now should be straight forward to fix as it seems quite self-explanatory, I think that you just need to use the correct model name when creating the BREAD:

Make sure to use the correct model name based on the one that you've created hen using the artisan command.

Let me know how it goes!

hserrouya

Jun 18th, 2024 01:48 AM

Thanks, Yes, it is working good. Do you have a video to explain how to create a crud page using wave? Thanks

bobbyiliev

Jun 18th, 2024 02:31 AM

Hey,

Here is a playlist of videos where Tony goes over on how to build a SaaS with Wave:

Building a SaaS

It includes quite a few videos.

If this is not exactly what you are after, feel free to share more about what type of CRUD you are interested in, is it just the CRUD in Voyager, or is it for your frontend, are you using Livewire or just standard controllers, and etc.

hserrouya

Jun 18th, 2024 02:53 AM

Hi, I've already did it in voyager but i need it for the frontend. I'm using standard controllers.

bobbyiliev

Jun 19th, 2024 05:58 AM

Hey!

In this case it will be just as with any other standard Laravel application.

In Voyager you will have your standard BREAD which will mainly be used by site admins.

And then on the frontend, you will create your routes and controllers as you would with any Laravel application.

Creating Routes and Controllers

  1. Define Routes: Add your routes in routes/web.php:

    Route::resource('books', 'BookController');
    
  2. Create Controller: Generate a controller:

    php artisan make:controller BookController --resource
    
  3. Implement Controller Methods: In app/Http/Controllers/BookController.php, add methods for CRUD operations:

    // Display a listing of the resource.
    public function index()
    {
        $books = Book::all();
        return view('books.index', compact('books'));
    }
    
    // Show the form for creating a new resource.
    public function create()
    {
        return view('books.create');
    }
    
    // Store a newly created resource in storage.
    public function store(Request $request)
    {
        $request->validate([
            'title' => 'required',
            'author' => 'required',
            'year' => 'required|integer',
        ]);
    
        Book::create($request->all());
        return redirect()->route('books.index');
    }
    
    // Display the specified resource.
    public function show(Book $book)
    {
        return view('books.show', compact('book'));
    }
    
    // Show the form for editing the specified resource.
    public function edit(Book $book)
    {
        return view('books.edit', compact('book'));
    }
    
    // Update the specified resource in storage.
    public function update(Request $request, Book $book)
    {
        $request->validate([
            'title' => 'required',
            'author' => 'required',
            'year' => 'required|integer',
        ]);
    
        $book->update($request->all());
        return redirect()->route('books.index');
    }
    
    // Remove the specified resource from storage.
    public function destroy(Book $book)
    {
        $book->delete();
        return redirect()->route('books.index');
    }
    

Creating Views

  1. Create Blade Templates: Create views in resources/views/books for listing, creating, editing, and showing books. Example for index.blade.php:

    @extends('layout')
    
    @section('content')
    <h1>Books</h1>
    <a href="{{ route('books.create') }}">Add New Book</a>
    <ul>
        @foreach ($books as $book)
            <li>{{ $book->title }} by {{ $book->author }} ({{ $book->year }})
                <a href="{{ route('books.edit', $book->id) }}">Edit</a>
                <form action="{{ route('books.destroy', $book->id) }}" method="POST">
                    @csrf
                    @method('DELETE')
                    <button type="submit">Delete</button>
                </form>
            </li>
        @endforeach
    </ul>
    @endsection
    
  2. Create Other Views: Similarly, create create.blade.php, edit.blade.php, and show.blade.php.

Feel free to share more information about the end goal here and I can share more concrete example.

- Bobby

hserrouya

Jun 24th, 2024 03:26 AM

Hi, After deploying to DO, I'm getting a 500 error that is not exist in local. The only things i think about is the use of CURL that should be enabled. After research, I don't know how to enable curl in the DO app itself. I've tried app-get... but the command is not recognized. What is the best practice do enable curl in DO App? Thanks

bobbyiliev

Jun 24th, 2024 03:41 AM

Hi,

You can enable any PHP extension by just specifying them in the composer.json file.

Here is an example:

composer.json#L13

Just add "ext-curl": "*", after line 13.

After that, make sure to run composer update and commit the composer.json and lock files to your repository.

Here is a link to a discussion that explains this:

https://www.digitalocean.com/community/questions/how-to-enable-php-redis-on-an-existing-digital-ocean-application

Also, whenever you get a 500 error, it is best to check the laravel log, to see what the actual problem is, the 500 error is just a generic error which does not give any information on what the problem might be, but that information should be available in the log.

Let me know how it goes.

hserrouya

Jun 24th, 2024 06:30 AM

Thanks, Yes it is working! The problem is that I'm doing a POST CURL that take more than 30 sec. Do you know where in DO I can update the max execution time? Thanks a lot

bobbyiliev

Jun 24th, 2024 06:57 AM

Hey!

The easiest way to edit the php.ini settings on the DigitalOcean App Platform is to add a .user.ini file to your codebase with the following lines in it. These lines will set the values for max_execution_time:

max_execution_time=60

https://www.digitalocean.com/community/questions/how-to-update-php-ini-on-a-digitalocean-app

However note that there might be some other hard limits on the App Platform that would not let you increase the max execution time indefinitely.

Let me know if this works.