- Docker
- PHP >= 7.13
- Mysql 5.7
- Laravel ~5.6
- Redis
- npm or yarn (recommend)
We use Docker and Docker Compose for constructing the development environment of the application. Therefore, we first need to install these two softwares:
- Install Docker: https://docs.docker.com/install
- Install Docker Compose: https://docs.docker.com/compose/install
Make sure docker
and docker-compose
commands are available in current shell.
In order to run docker
command without sudo privilege:
- Create docker group if it hasn't existed yet:
sudo groupadd docker
- Add current user to docker group:
sudo gpasswd -a ${whoami} docker
- You may need to logout in order to these changes to take effect.
Change current directory to application code folder and run the following commands:
- Copy file
.env.example
to.env
,docker-compose.yml.example
todocker-compose.yml
- Start up docker containers:
docker-compose up -d
. To stop docker containers, usingdocker-compose stop
command - Change to workspace environment:
docker exec -it love_workspace bash
Inside workspace container, run the following commands:
- Install composer packages:
composer install --no-suggest
- Change permission for some directories:
chmod -R 777 storage/ bootstrap/
- Seed the database:
php artisan db:seed
If you update these environment variables, you must restart docker containers in order to those changes to take effect.
- Site will publish on 127.0.0.1:{
ports
} (ports
config in docker-compose.yml > services > ngix > ports). Add domain to host file so we can access site by domain:{ports
}
127.0.0.1 love.local
127.0.0.1 admin.love.local
By default, port 80 of NGINX container is mapped to port 4040 of the host machine. If this port is currently used by another application, you can change that port by editing docker-compose.yml
.
Quick deploy: Run after each time you pull code from framgia repository
Run deploy
- Install laravel
composer install
php artisan key:generate
- Install node modules
npm install
#or
yarn install
- Build
npm run dev
#or
yarn run dev
- Run migration
# Check Docker Container list, copy the `workspace` container name
docker ps
# Go into the `workspace` container
docker exec -it love_workspace bash
# Run migration
php artisan migrate --seed
# Or running outside the docker container
docker exec -it love_workspace php artisan migrate --seed
- If you want run project on your local instead of Docker, just skip all step about docker and create virtual host. And modify
.env
config ofDB_HOST
,DB_HOST_TEST
,REDIS_HOST
to127.0.0.1
Create new client with type "Other", then save file credentials in path 'storage/google/credentials.json'.
Run command
php artisan google:get-token
Open the link on the screen to the browser, then copy code receive from browser in command. If successful, the token file will be saved in path 'storage/google/token.json'
Data chatwork user contains in file 'config/chatwork-users.php'
Add hook to link {host}/api/chatwork/hook
Run command
php artisan queue:table
php artisan migrate
php artisan queue:work
Run command
crontab -e
Add to file new line with content
* * * * * docker exec love_workspace php artisan schedule:run >> /dev/null 2>&1
Replace love_workspace
with name your workspace.
And restart cron:
sudo service cron restart