PipeCodes INTRANET

Environement Configure

WordPress

React/Next/Laravel

Local Development

Laravel

Herd
https://herd.laravel.com/
Herd for macOS is a local development environment manager that simplifies setting up and managing PHP projects with tools like Laravel, WordPress, and more.



Staging/Prod Server

Vercel

TODO

Forge

TODO

Server SSH

0. If Dependencies are not yet installed in the server, please start HERE first
Make sure your prod and staging server shares the same software versions – Apache/NGinx, PHP, Mysql/MariaDB, Nodejs

1. SSH into the server

2. Create your folder under /var/www/html
Ex: mkdir /var/www/html/va-cards-backoffice

3. Enter in the folder and clone the project from GitHub
You may not have permissions.
If not, first check or create the server public key:
https://www.digitalocean.com/community/tutorials/how-to-set-up-ssh-keys-on-ubuntu-20-04
And add it into your Github Project Keys under https://github.com/NAMESPACE/PROJECT_NAME/settings/keys

Still facing permission issues?
Install and setup github CLI:
https://github.com/cli/cli/blob/trunk/docs/install_linux.md#official-sources

Auteticate using:
gh auth login
(use the option to copy & paste a personal access token)

Clone the repo like:
git clone https://TOKEN@github.com/OWNER/REPO.git

4. For Prod – Use main branch | For client staging – Use staging branch

5. Setup the webserver
https://www.digitalocean.com/community/tutorials/how-to-set-up-nginx-server-blocks-virtual-hosts-on-ubuntu-16-04

6. Setup the database and database user
https://www.digitalocean.com/community/tutorials/how-to-create-a-new-user-and-grant-permissions-in-mysql

Enter MySQL:
sudo mysql OR mysql -u root -p

Create database:
CREATE SCHEMA va_cards_backoffice_api;

Create user & permissions:
CREATE USER ‘va_cards_backoffice_api’@’localhost’ IDENTIFIED BY ‘GENERATED_SECURE_PASSWORD’;
AFHY3fWUgdsE3hd

GRANT ALL PRIVILEGES ON YOUR_DB.* TO ‘va_cards_backoffice_api’@localhost IDENTIFIED BY ‘GENERATED_SECURE_PASSWORD’;
FLUSH PRIVILEGES;
SHOW GRANTS FOR ‘va_cards_backoffice_api’@localhost;

7. Create the .env, update the database and other required data and run the correspondent deployment commands
# here you may need to install sime required php extensions
# you may also need to run your commands in sudo mode

composer install –no-dev –no-interaction –prefer-dist –optimize-autoloader

npm install
npm run build
rm -rf public/hot

php artisan migrate –force
php artisan storage:link

# if you want to refresh all the data WARNING (Makes sense only first running)
#php artisan migrate:fresh –seed –force

php artisan cache:clear
php artisan route:clear
php artisan config:clear

Make sure Webserver is pointed into public folder

FOR NextJS/React applications:
npm install
npm run build

Make sure Webserver is pointed into build folder

8. It’s a Settings Backoffice or Private App/API?
Update robots.txt into

User-agent: *
Disallow: *

9. Test the app and logins

10. Configure GitHub Actions for auto deployments