To containerize a web application in lightweight environment known as containers, I use Docker Compose for the service, framework such as Laravel Application, Nginx Server, MySQL Database, phpMyAdmin...
System | Language | Framework | Web Server | Database |
---|---|---|---|---|
Ubuntu 20.04 | PHP | Laravel | Nginx | MySQL (phpMyAdmin) |
OIC Website is website which allowed host user (host of event) to handle their event post (view, create, edit, delete), generete their invited code (event code) for their guest (guest of event). The invited code is way help that their guest are able to viewing the event and the guest could to post their comment on the event by create an account and log in.
The website has two role for users include:
- Host - Who create event post:
- All of the guest features
- Handle the event post with:
- Create
- View
- Update (edit)
- Delete
- Guest - Who invited by host:
- View:
- The detail information of event with the invited code preview here
- The basic information of the others
- Sign up and Login:
- With sign up or recovery password feature, User has to use their email to verify
- Congrat or Comment (only user who is logged in)
- Become to Host with logged in account
- View:
In the future, I will complete the card generation for the event with vary of template ^^
/
: View an event with invited code/about
: About OIC Website/event
: View all events/event/{uuid}
: View an event/event/create
: Create new event/event/{uuid}/edit
: Edit an event
/login
: Log in/register
: Register/forgot-password
: Recovery password
As mentioned in head of this README, I will use Docker Compose to containerized the project.
All of I wrote in this docker-compose.yml and Dockerfile.
To run the OIC Website:
- Get this repo:
git clone https://github.com/nh4ttruong/oicapp
- I put the
.env.example
file here, copy and edit this file:
cd oicapp
cp .env.example .env
- Install
docker
anddocker-compose
- After that, turn the containers up. The command below will up all containers in
docker-compose.yml
file. In local, your web app will appear onhttp://localhost:8080
and yourphpMyAdmin
will appear onhttp://localhost:8081
:
sudo docker-compose up -d
- Generate
APP_KEY
for your Laravel Application:
sudo docker-compose exec app php artisan key:generate
- Make
composer
up to date:
sudo docker-compose exec app composer update
#clear config cache
sudo docker-compose exec app php artisan config:cache
- Access mysql and grant for
mysql
user root (this step is helpful when error appear suddently ^^):
sudo docker-compose exec db bash
mysql -u root -p
#type your database password in .env file
mysql> show databases;
mysql> GRANT ALL ON oicappdb.* TO '<your database username>'@'%' IDENTIFIED WITH '<your database password>';
mysql> FLUSH PRIVILEGES;
mysql> exit;
- Comeback the shell, make the seed file run (sample database):
sudo docker-compose exec app php artisan migrate:fresh --seed
sudo docker-compose exec app php artisan db:seed --class=PermissionSeeder
sudo docker-compose exec app php artisan db:seed --class=CreateRoleSeeder
- Make storage link for static source show up:
sudo docker-compose exec app php artisan storage:link
If you can't make /storage
public, you could to search the problem on stackoverfow or visit File Storage - Laravel Documentation.
Finaly, access http://localhost:8080
to view OIC Website and http://localhost:8081
to log in phpMyAdmin
portal.
Hi, maybe in the Setup & Run
process, the bug will come up. Try to search it with Google to get the fixing way, all method are arround there (because I tried and got success ^^) - Good luck!