Website Link: https://the-book-planet.000webhostapp.com/
A catalogue where all the book information can be seen and can be also exported as CSV and XML. There is a search box for quicker access and the list can also be sorted. One can even add a new book information (title & author), update the same if required and delete book info.
- Clone the repository.
- Start the containers by running
docker-compose up -d
in the project root. - Install the composer packages by running
docker-compose exec laravel composer install
. - Access the Laravel instance on
http://localhost
(If there is a "Permission denied" error, rundocker-compose exec laravel chown -R www-data storage
).
Note that the changes you make to local files will be automatically reflected in the container.
If you want to make sure that the data in the database persists even if the database container is deleted, add a file named docker-compose.override.yml
in the project root with the following contents.
version: "3.7"
services:
mysql:
volumes:
- mysql:/var/lib/mysql
volumes:
mysql:
Then run the following.
docker-compose stop \
&& docker-compose rm -f mysql \
&& docker-compose up -d
This app uses MySQL.
- To access the running container (in this case “assignment01-laravel”), in the project root, run:
docker exec -it assignment01-laravel bash
- To create all the necessary tables and columns, run the following
php artisan migrate
To add the dummy titles and author, run:
php artisan db:seed
- To access the running container (in this case “
assignment01-laravel
”), in the project root, run:
docker exec -it assignment01-laravel bash
- Always clear configuration cache before running tests:
php artisan config:clear
- Run PHPUnit tests by:
./vendor/bin/phpunit
This should look like the image below:
Hosting over InfinityFree
-
Sign up or Log in.
-
Navigate to account section called
Hosting Accounts
, andCreate Account
where subdomain and domain extension will be registered based on availability. -
Click on account created and go to the
Control Panel
. Approve and proceed. -
In
DATABASES
click onMySQL Databases
and create a database. -
Download and open FileZilla (from
Free FTP Software
in cpanel).- Inside the application, go to
File
and create aNew site
fromSite Manager
with cpanel account FTP HostName, Port21
, FTP Username, Logon TypeNormal
and FTP Password.- Please reset FTP password in case it doesn’t work the first time.
- Inside the application, go to
-
After successful connection, directory
/
should appear, which hashtdocs
inside it. -
Inside htdocs, create a new directory (for example say:
laravel
). -
Go to the laravel project to be deployed on the left.
-
Upload the contents of the
public
directory of the project tohtdocs
on the right and rest of the contents except 'public' (and '.git' if exists) directory to that new directory which was created in step 7 (‘laravel
’ in this example). -
Once uploaded, go to
control panel
again from step 3. -
Click on
Online File Manager
in FILES and thenhtdocs
. Edit and update the paths inindex.php
file for new folder name (for example herelaravel
)
Example below:
Before:__DIR__.'/../bootstrap/app.php'
After:
__DIR__.'/laravel/bootstrap/app.php'
-
Delete
config.php
(if exists) from/htdocs/laravel/bootstrap/cache
. -
Update contents of
.env
file inside/htdocs/laravel
with the right data for db host, port, database name, username and password which were created earlier. -
From local environment database
export
all tables. -
In cpanel, go to
MySQL Databases
in DATABASES again and click onAdmin
. Click onImport
from top toolbar and select the exported file from the previous step. -
The laravel project should work now.
Hosting over 000webhost
-
Sign up or Log in.
-
Create a new website
. -
Click on
Manage
. -
In
FILES
click onFile Manager
. -
Upload compressed form of the local laravel project and Unzipper php in
public_html
. -
Go to
https://<website-name>.000webhostapp.com/unzipper.php
. -
Select the right laravel project compressed file and click on
Unzip Archive
. -
Move unzipped contents of laravel project to '
/
'. -
Delete
public_html
directory and rename currentpublic
to “public_html”. -
In
app/providers
add the following toAppServiceProvider.php
:public function register(): void { $this->app->bind('path.public', function(){ return base_path('public_html'); }); }
-
Go to
.env
file and copyAPP_KEY
after ‘base64:’ -
Navigate to
/config/app.php
. Paste and save the previously copied value as:
'key' => env('APP_KEY', base64_decode(‘copied_APP_KEY_value’))
-
From local project environment database
export
all tables. -
In the website dashboard, scroll down to
DATABASES
and click onMySQL Databases
toCreate New Database
. -
In
Manage Database
, from the newly created database, click onPhpMyAdmin
on the right. -
Click on
Import
from top toolbar and select the previously exported file. -
Update the
.env
file with all the new details such as:
DB_HOST
,DB_DATABASE
,DB_USERNAME
andDB_PASSWORD
. -
Visit the created website again and if everything is working as it should, in
.env
file, makeAPP_DEBUG=false
.
1.0.0
Monika Rabha