Backup
Jika menggunakan dedicated server/VPS stop terlebih dahulu layanan apache web server.
sudo systemctl restart apache2
Backup direktori
Salin atau compress directory tempat kita menginstall crater invoice.
zip -rv /home/fariz/hasil-backup-crater.zip /var/www/crater/
Backup Database.
mysqldump -u root -p craterdb > hasil-backupdb-crater.sql
Restore
Restore direktori
Salin/pindahkan direktori (file compress) dan database kedalam server baru.
Unzip file backup.
unzip hasil-backup-crater.zip
Pindahkan hasil extract kedalam direktori /var/www
sudo mv crater/ /var/www/
Restore database
Buat user dan database.
sudo mysql
Buat database.
MariaDB [(none)]> create database craterdb;
Buat user database.
MariaDB [(none)]> create user 'namauser'@'localhost' identified by 'PassWordDB';
Berikan izin user untuk mengelola database.
MariaDB [(none)]> grant all privileges on craterdb.* to 'namauser'@'localhost';
Flush !! .
MariaDB [(none)]> flush privileges;
Exit.
MariaDB [(none)]> quit;
Restore isi database.
mysql -u root -p craterdb < hasil-backupdb-crater.sql
Konfigurasi .env
Pergi ke direktori crater.
cd /var/www/crater/
Edit file .env
.
nano .env
Sesuaikan parameter yang ditandai warna orange berikut:
APP_ENV=production
APP_KEY=base64:JVcfcaL8V7bAdOJEHNJ+q322vF4AJCoYLSHbVdcXsDI=
APP_DEBUG=true
APP_LOG_LEVEL=debug
APP_URL=http://DOMAIN-IP:PORT
DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=craterdb
DB_USERNAME=namauser
DB_PASSWORD=PassWordDB
BROADCAST_DRIVER=log
CACHE_DRIVER=file
QUEUE_DRIVER=sync
SESSION_DRIVER=cookie
SESSION_LIFETIME=1440
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_DRIVER=smtp
MAIL_HOST=mail.servermail-kamu.com
MAIL_PORT=465
MAIL_USERNAME=[email protected]
MAIL_PASSWORD="PasswordMail"
MAIL_ENCRYPTION=ssl
MAIL_FROM_ADDRESS=[email protected]
MAIL_FROM_NAME="NAMA PENGIRIM"
PUSHER_APP_ID=
PUSHER_KEY=
PUSHER_SECRET=
SANCTUM_STATEFUL_DOMAINS=DOMAIN-IP:PORT
SESSION_DOMAIN=DOMAIN-IP
TRUSTED_PROXIES="*"
CRON_JOB_AUTH_TOKEN=""
*Catatan: Gunakan string (“”) jika value kamu berisikan karakter khusus.
Ubah izin dan kepemilikan
sudo chown -R www-data:www-data /var/www/crater/
chmod -R 775 /var/www/crater/
Buat VirtualHost / VirtualBlock
Buat file konfigurasi.
sudo nano crater.conf /etc/apache2/sites-available/
Lalu sesuaikan parameter berikut yang ditandai warna orange
Listen 8001
<VirtualHost *:8001>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/crater/public
<Directory /var/www/crater/public>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
Jalankan konfigurasi yang telah dibuat.
sudo a2ensite crater.conf
Reload Apache.
sudo systemctl reload apache2
Restart Apache.
sudo systemctl restart apache2
Konfigurasi crontab untuk recurring invoice
Disini saya akan menjelaskan cara konfigurasi crontab dari VPS (Linux) untuk cara konfigurasi crontab melalui sudah saya jelaskan di tutorial cara instalasi crater
Gunakan user root.
sudo crontab -e
Isikan Ini dibagian paling bawah
# Crater
* * * * * cd /var/www/crater && php artisan schedule:run >> /dev/null 2>&1