How to Update in VPS server(Optional)
- Open the package folder
- You will find Update_Docker.zip file here.
- Unzip the Update_Docker.zip file in the root your server
-
Now please run the following command in order to build and run the project.
sudo docker-compose up -d --build
- Yor site will be updated
How to Install in VPS server(Optional)
Installing in VPS server is fully optional. You can skip this page if you don't have any knowledge on Docker.
Requirements
Server must have these pre installed:
- Unzip
- Docker
- Docker compose
Please create a machine and SSH to your machine.
Process of creating a machine varies server to server. If you are unable to figure out the process, please contact the support team of your server. They will help you to create a machine and tell you the process of the SSH.
Unzip
Please run the following command in order to install unzip
sudo apt-get
install unzip
Docker
Please run the following command in order to install docker
sudo apt update
sudo apt install apt-transport-https ca-certificates curl
software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add
-
sudo add-apt-repository "deb [arch=amd64]
https://download.docker.com/linux/ubuntu bionic
stable"
sudo apt update
apt-cache policy docker-ce
sudo apt install docker-ce
If this command fails to install docker, please run following two commands then try to run the command again.
curl -O
https://download.docker.com/linux/debian/dists/buster/pool/stable/amd64/containerd.io_1.4.3-1_amd64.deb
sudo apt install ./containerd.io_1.4.3-1_amd64.deb
sudo apt install docker-ce
sudo systemctl status docker
Docker compose
Please run the following command in order to install docker compose
sudo curl -L
https://github.com/docker/compose/releases/download/1.21.2/docker-compose-`uname
-s`-`uname -m` -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
docker-compose --version
Installing the app
After installing those apps please follow these steps.
- Make zip from Docker.
- Upload it to your server.
- unzip it.
- Go to the project by running the following command.
unzip Docker.zip
cd Docker
User adding for docker
Now please run the following command in order to add as user for the docker.
sudo groupadd docker
sudo usermod -aG docker $USER
Backend configuration
- Now open the .env file by running the following command.
- Change the value of APP_URL and CLIENT_BASE_URL.
- APP_URL: URL of your admin panel. eg. http://admin.yourdomain.com
- CLIENT_BASE_URL: URL of your frontend. eg. http://www.yourdomain.com
- Now save the file by running the following commands.
nano .env
Type ctrl + x
Type Shift + y
Press Enter
Frontend Configuration
- Please go back to the root of the project by running the following command.
- Now please run the following command in order to go inside the frontend folder.
- Now open the .env file by running the following command
- Change the API_BASE form .env file
- API_BASE: Root Url of your admin panel. eg. http://www.yourdomain.com
- Please don't forget to add / at the end of the URL
- Now save the file by running the following commands.
cd ..
cd frontend
nano .env
Type ctrl + x
Type Shift + y
Press Enter
NGINX Configuration
- Please go back to the root of the project by running the following command.
- Now run the following command in order to go inside the nginx configuration folder.
- Now edit the default.conf file by running.
- Navigate through Down arrow and find server_name. You will find the server_name in two places.
- Put your domain url in the first occurrence
- Put your admin url in the second occurrence
- Now save the file by running the following commands.
cd ..
cd nginx/config
nano default.conf
Type ctrl + x
Type Shift + y
Press Enter
Setting permission to the storage folder
Now please run the following command in order to go inside the backend folder.
cd backend
Now please run the following command in order to set permission to storage folder.
sudo chown -R $USER:www-data storage
chmod -R 775 storage
sudo chown -R $USER:www-data bootstrap/cache
chmod -R 775 bootstrap/cache
sudo chmod -R 777 public/uploads
Run and build docker
Now please run the following command in order to build and run the project.
sudo docker-compose up -d --build
Database migration and passport install
- Now its time to run the database migrations in the backend. Please Run the following command to start to go to the app image:
- Please Clear the cache by running these commands:
- Run the migration by running these commands:
- Please Clear the cache one last time by running the commands above (Step: 2).
- Please exit from the container
docker-compose exec app bash
php artisan route:cache
php artisan route:clear
php artisan config:cache
php artisan config:clear
php artisan cache:clear
php artisan optimize
php artisan migrate:fresh --seed
php artisan passport:install
exit
Rebuild and run docker
- Please go back to the root of the project by running the following command.
- Now please run the following command in order to build and run the project.
- You can access the website and the admin panel from the URL in the browser now. eg. http://yourdomain.com and http://admin.yourdomain.com
- Use these credentials below to login to the admin panel
- Admin email: admin@mail.com
- Admin password: 123456
- Please Clear the cache one last time by running the commands above (Last paragraph, Step: 2).
cd ..
sudo docker-compose down
sudo docker-compose up -d --build