strapi v4 with postgres error, database does not exist - strapi

I have tried to install the latest strapi version with the following command:
npx create-strapi-app#latest strapi_test
After going through the manual steps and choosing postgres as my db, from within my folder I run the yarn develop command, but then I get the following error:
debug: ⛔️ Server wasn't able to start properly.
error: database "strapi_test" does not exist
What have I done wrong?
I am running node v16.13.0, npm v8.2.0 and on Mac OS Monterey v12.2.1

Had the same problem, turns out you need to create the database yourself with psql. So you need to run:
psql -U postgres
create database strapi_test;
It should work correctly after this.

Related

Laravel giving error "Your lock file does not contain a compatible set of packages. Please run composer update"

I am trying to host my application using Microsoft Azure. When I build my laravel web to Azure web app, the error I get is "Your lock file does not contain a compatible set of packages. Please run composer update". I have run the command "composer update" but still get the same error.
enter image description here
Does anyone know how to solve this?
You have the solution on your screenshot - enable php extension ext-fileinfo. How? Check documentation
Or, for just test deploy - add flag to install command
composer install --ignore-platform-reqs

Laravel Sail is not working properly in Ubuntu 20.04 LTS

Hi i tried to install fresh Laravel project using
Laravel Sail
docker environment. First it was showing me "Docker is not running" error. Then i found out, i needed to start docker as rootless. I solved it, reading this url: [https://docs.docker.com/engine/install/linux-postinstall/].
After that, I successfully installed Laravel using Laravel Sail. Then I ran
./vendor/bin/sail up -d
I was able to view Laravel project in my browser. But when i ran any other artisan commands such as ./vendor/bin/sail artisan route:list or sail commands as sail shell, all the docker containers were forced closed automatically. It shows me this error.
Sail is not running.
You may Sail using the following commands: './sail up' or './sail up
-d'
Any suggestions? I am getting this issue on Ubuntu 20.04 LTS version.
If you are on Windows and using WSL, make sure the WSL Integration is properly set:
Settings->Ressources->WSL Integration + Toggle Linux version
I was using Laradock before installing Laravel Sail. Maybe there were some conflicts. So I backed up all my databases, then I removed all containers using this code. sudo docker rmi -f $(docker images -a -q). Then installed fresh Laravel project and it worked.
Please read my below comment as it is was a better solution for me.
very easy, maybe you don't have permission to run docker.
in Linux first use sudo -s and after user ./vendor/bin/sail up -d
Sail first checks to see if any current docker-compose processes have a status of Exit. If any of them have, then it will forcefully bring down all other services. Which is what you were are seeing whenever you type any sail sub-command. You can see the code here: https://github.com/laravel/sail/blob/87c63c2956749f66e43467d4a730b917ef7428b7/bin/sail#L44-L49
Run sail up to start the processes and then use docker-compose ps to check all services are running and none have an Exit status.
I had the same issue and when reviewing the code and checking my services I noticed the database had exited soon after I brought them up.

Can Strapi be deployed through Amazon Lightsail?

So far I have set up a mySQL server on Amazon lightsail and have succesfully used it while running strapi locally. How do I deploy Strapi itself on lightsail and get a link to access it through a browser?
I have read through https://strapi.io/documentation/3.0.0-beta.x/deployment/amazon-aws.html, but the guide is for AWS EC2. Do the same steps apply to lightsail?
So I ended up figuring out. Please let me know if something is wrong or can be done better:
Start an Ubuntu instance in lightsail, I picked the 2GB RAM tier because that's the min requirements for Strapi to run (they have them listed in their documents) and give it a static IP address.
Install node onto your server:
cd ~
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
...
sudo apt-get install nodejs
...
node -v && npm -v
I cloned my project from github, so a lot of node modules weren't imported due to .gitignore. Simply cd into the project direcotry and run node install to install all the missing dependencies.
run npm build to build the panel, then npm start
it should tell you to go to localhost:1337, instead go to [your server's IP address]:1337
your Strapi app should be on the screen
Yes, The strapi can be deployed to Lightsail. But there will be no advantages.
Lightsail must be configured as a Node.js server.
Deploy from github
Install PM2 Runtime

Running symfony3 on Openshift, composer not found

I recently discover OpenShift and look exactly what I needed. Now I'm trying to running a simple symfony3 project on it. I create an application with this cartridge (since I need php 5.5), successfully installed after waiting some minutes ,and then upload a symfony project from my local laptop to the created www folder. Now I'm lost on how to activate composer to install and update vendors.
I read this link, and as it say I create an empty file called use_composer in the marker folder. Then I login with a putty client, go to my project folder(app-root/runtime/repo/www/symfony/), but executing composer install on it give me 'composer: command not found'. I'm sorry if it's a newbie question, but in fact I'm not a linux user. Maybe I need to restart the application or something.
Any help will be appreciated.
I find an answer from this article
Execute curl -s https://getcomposer.org/installer | php -- --quiet --install-dir=$OPENSHIFT_DATA_DIR
Now you can call composer like this php $OPENSHIFT_DATA_DIR/composer.phar update

Openshift and HtmlServiceProvider

I have pushed my local app to openshift and now get the following error message
PHP Fatal error: Class 'Illuminate\Html\HtmlServiceProvider' not found in /var/lib/openshift/5728b9782d5271802600015c/app-root/runtime/repo/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php on line 150
How do I fix this on Openshift?
The solution locally would be to run composer update but how do I run that command on Openshift? I know there is rhc command line tool but is it possible to do a composer update with rhc?
You should check for the files first. You may have corrupted/missing files during upload. If you do not have vendor directory, you shoudl run composer update.
If files are there, run composer dumpauto on the server.
You can connect to you server with SSH and run these commands from terminal.
If you do not have access to SSH, you could try to run there commands using small PHP script with shell_exec('composer update'); clause in it, or just upload all vendor files manually.
I got ssh access and did the commands necessary to correct the problems

Resources