Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ezralazuardy/adcs
π₯οΈ Automated Autonomous Drone Communication System Manager
https://github.com/ezralazuardy/adcs
inertiajs laravel mqtt vue
Last synced: 23 days ago
JSON representation
π₯οΈ Automated Autonomous Drone Communication System Manager
- Host: GitHub
- URL: https://github.com/ezralazuardy/adcs
- Owner: ezralazuardy
- Created: 2021-11-30T14:13:27.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-03-14T23:53:54.000Z (over 1 year ago)
- Last Synced: 2024-10-02T08:16:59.659Z (about 1 month ago)
- Topics: inertiajs, laravel, mqtt, vue
- Language: PHP
- Homepage:
- Size: 3.89 MB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- Security: SECURITY.md
Awesome Lists containing this project
README
# π₯οΈ adcs
A manager and backend server for Automated Autonomous Drone Communication System.
π¨ Built with [Laravel Jetstream](https://jetstream.laravel.com) and [Inertia.js](https://inertiajs.com) for Single Page
Application builder ([PWA](https://web.dev/progressive-web-apps) enabled).β‘ Supercharged with [Laravel Octane](https://laravel.com/docs/8.x/octane) for massive server performance boost.
> β οΈ **Important Notes**
>
> - [Swoole](https://www.swoole.co.uk) need to be installed in the server in order to use Laravel Octane.
> - Please respect the Laravel Octane [rules and limitations](https://laravel.com/docs/8.x/octane#dependency-injection-and-octane) in order to avoid memory leaks.### π€ Runtime Components
In order to test the ADCS functionalities, you need to run several component instance based on
this [repository](https://github.com/ezralazuardy/adcs-runtime). Based on the given topology below, you need to run the
Drone instances (min. 1 instance) and the Commander Server instance.### πΊοΈ Topology
![ADCS Software Topology](https://user-images.githubusercontent.com/24422019/144341602-86e17ae4-3991-470f-9d56-b5dd3ac18941.png)
## β Technologies & Standards
1. [Laravel](https://laravel.com/docs/8.x) `v8`
2. [Laravel Eloquent](https://laravel.com/docs/8.x/eloquent)
3. [Laravel Events](https://laravel.com/docs/8.x/events)
4. [Laravel Queues](https://laravel.com/docs/8.x/queues)
5. [Laravel Task Scheduling](https://laravel.com/docs/8.x/scheduling)
6. [Laravel Mix](https://laravel.com/docs/8.x/mix)
7. [Laravel Broadcasting](https://laravel.com/docs/8.x/broadcasting)
8. [Laravel Jetstream](https://jetstream.laravel.com)
9. [Laravel Fluent](https://github.com/lepikhinb/laravel-fluent)
10. [Laravel Octane](https://laravel.com/docs/8.x/octane) optional
11. [Laravel Cloudflare](https://github.com/monicahq/laravel-cloudflare) optional
12. [Laravel Sail](https://laravel.com/docs/8.x/sail) optional
13. [PHP PSR2 Coding Style Standard](https://www.php-fig.org/psr/psr-2)
14. [PHPStan](https://phpstan.org/) (with [Larastan](https://github.com/nunomaduro/larastan) extension)
15. [Inertia.js](https://inertiajs.com)
16. [Vue.js](https://vuejs.org)
17. [Webpack](https://webpack.js.org)
18. [Supercronic](https://github.com/aptible/supercronic)
19. [Supervisor](http://supervisord.org/index.html)
20. [MySQL](https://dev.mysql.com) `v5`
21. [PHP MQTT](https://github.com/php-mqtt/client)
22. [Pusher](https://pusher.com)
23. [Swoole](https://www.swoole.co.uk) optional
24. [Github Action CI/CD](https://github.com/features/actions) optional
25. [Docker](https://www.docker.com) optional
26. [Sentry](https://sentry.io) optional
27. [Yarn](https://yarnpkg.com) optional
## π¨βπ» Getting Started
Ikuti salah satu dari langkah berikut untuk melakukan deploy aplikasi pada tahap **development**.
### π Docker
Langkah instalasi dockerized application dengan β΅ Laravel Sail untuk memudahkan proses deployment aplikasi
#### βοΈ Requirement
1. PHP `v8.0`
2. Composer `v2`
3. [Docker](https://www.docker.com)
- [Docker for Windows](https://docs.docker.com/docker-for-windows/install) `v4.0.1`
- [Docker for Linux](https://docs.docker.com/engine/install) `v4.0.1`
- [Docker for Mac](https://docs.docker.com/docker-for-mac/install) `v20.10`#### π₯οΈ Installation
1. Clone repository ini ke local environment, lalu checkout ke `development` branch
2. Buat file `.env` dengan menyalin file `.env.example`, lalu konfigurasikan seperti berikut:
- Ubah `APP_ENV` menjadi `local`
- Ubah `APP_DEBUG` menjadi `true`
3. `composer i --ignore-platform-reqs`
4. `vendor/bin/sail up`> #### π Informasi
> - Jika menggunakan OS Windows, jalankan Laravel Sail dalam [Windows WSL v2](https://ubuntu.com/wsl)
> - Akses aplikasi via web pada alamat `http://127.0.0.1`
> - Alamat URL dan port aplikasi yang digunakan Laravel Sail sesuai konfigurasi pada `.env`> #### π Rekomendasi
> - Pelajari perintah **Laravel Sail** pada dokumentasi [berikut](https://laravel.com/docs/8.x/sail)### π‘ Self Hosted
Langkah tradisional untuk melakukan deploy aplikasi pada local atau self-hosted environment
#### βοΈ Requirement
1. PHP `v8.0`
2. Composer `v2`
3. MySQL Server `v5.7`
4. NodeJS `v16`
5. Yarn `v1`
6. [Laravel Homestead](https://laravel.com/docs/8.x/homestead)
/ [Laravel Valet](https://laravel.com/docs/8.x/valet) optional#### π₯οΈ Installation
1. Buat MySQL database untuk aplikasi:
- `mysql -u root -p`
- `create database adcs;`
- `create user 'adcs'@'localhost' identified by 'adcs';`
- `grant all privileges on adcs.* to 'adcs'@'localhost';`
- `flush privileges;`
- `exit;`
2. Clone repository ini ke local environment, lalu checkout ke `development` branch
3. Buat file `.env` dengan menyalin file `.env.example`, lalu konfigurasikan seperti berikut:
- Ubah `APP_ENV` menjadi `local`
- Ubah `APP_DEBUG` menjadi `true`
4. `composer i`
5. `php artisan app:install`> #### π Informasi
> - Pastikan ekstensi PHP yang dibutuhkan Laravel `v8` sudah terpasang pada local development environment, sesuai dokumentasi [berikut](https://laravel.com/docs/8.x/deployment)> #### π‘ Opsional
> - Gunakan `php artisan serve` untuk membuka aplikasi via PHP Built-in Web Server
> - Gunakan `php artisan queue:work database` untuk testing fitur [Queues](https://laravel.com/docs/8.x/queues)
> - Gunakan `php artisan schedule:run` untuk testing fitur [Task Scheduling](https://laravel.com/docs/8.x/scheduling)
> - Gunakan `php artisan optimize` saat setelah proses development untuk mempercepat performa aplikasi> #### π Rekomendasi
> - Gunakan `composer dev` untuk optimalisasi Laravel Intellisense pada IDE anda
> - Gunakan `composer lint` untuk menjalankan PHP Linter (Static Code Analaysis)
> - Gunakan local development environment seperti [Laravel Homestead](https://laravel.com/docs/8.x/homestead) / [Laravel Valet](https://laravel.com/docs/8.x/valet)
## ποΈ Production Deployment
Ikuti langkah berikut ini untuk melakukan deploy aplikasi pada tahap **staging** atau **production**.
### π‘ Self Hosted
Langkah tradisional untuk melakukan deploy aplikasi pada local atau self-hosted environment
#### βοΈ Requirement
1. PHP `v8.0`
2. Composer `v2`
3. MySQL Server `v5.7`
4. NodeJS `v16`
5. Yarn `v1`
6. [Nginx](https://nginx.org/en/download.html) / [Apache2](https://httpd.apache.org/download.cgi)
/ [LiteSpeed](https://openlitespeed.org/Downloads/)
7. [Supercronic](https://github.com/aptible/supercronic)
8. [Supervisor](http://supervisord.org/index.html)#### π₯οΈ Installation
1. Buat MySQL database untuk aplikasi:
- `mysql -u root -p`
- `create database adcs;`
- `create user 'adcs'@'localhost' identified by 'adcs';`
- `grant all privileges on adcs.* to 'adcs'@'localhost';`
- `flush privileges;`
- `exit;`
2. Clone repository ini ke server, lalu checkout ke `main` branch
3. Buat file `.env` dengan menyalin file `.env.example`, lalu konfigurasikan seperti berikut:
- Ubah `APP_ENV` menjadi `production`
- Ubah `APP_DEBUG` menjadi `false`
4. `composer i --no-dev`
5. `php artisan app:install`
6. Konfigurasikan Web Server dengan path **Document Root** mengarah ke lokasi direktori `public` pada proyek
7. Install **redis-server** untuk aplikasi:
- `sudo apt install redis-server`
- `sudo nano /etc/redis/redis.conf`, lalu ubah `supervised no` menjadi `supervised systemd`
- `sudo service redis-server restart`
8. Install **supercronic** untuk aplikasi:
- `sudo apt install snap`
- `sudo snap install go`
- `go get -d github.com/aptible/supercronic`
- `cd ~/go/pkg/mod/github.com/aptible/supercronic@v`
> Ubah `` ke versi terakhir supercronic sesuai laman [berikut](https://github.com/aptible/supercronic/releases)
- `go mod vendor`
- `go install`
- `source /etc/profile`
- Verifikasi instalasi supercronic dengan perintah `supercronic`
- Siapkan cronjob untuk aplikasi:
```bash
rm -rf ~/supercronic && \
sudo mkdir ~/supercronic && \
sudo touch ~/supercronic/adcs.cron && \
sudo echo "path=/var/www/adcs" >> ~/supercronic/adcs.cron && \
sudo echo "* * * * * php $path/artisan schedule:run >> /dev/null 2>&1" >> ~/supercronic/adcs.cron && \
sudo echo "0 1 * * * rm -rf $path/storage/logs/laravel.log && touch $path/storage/logs/laravel.log" >> ~/supercronic/adcs.cron && \
sudo echo "0 1 * * * rm -rf $path/storage/logs/adcs-cron.log && touch $path/storage/logs/adcs-cron.log" >> ~/supercronic/adcs.cron && \
sudo echo "0 1 * * * rm -rf $path/storage/logs/adcs-worker.log && touch $path/storage/logs/adcs-worker.log" >> ~/supercronic/adcs.cron && \
sudo echo "0 1 * * * rm -rf $path/storage/logs/adcs-octane.log && touch $path/storage/logs/adcs-octane.log" >> ~/supercronic/adcs.cron && \
sudo echo "0 1 * * * rm -rf $path/storage/logs/nginx-access.log && touch $path/storage/logs/nginx-access.log" >> ~/supercronic/adcs.cron && \
sudo echo "0 1 * * * rm -rf $path/storage/logs/nginx-error.log && touch $path/storage/logs/nginx-error.log" >> ~/supercronic/adcs.cron
```
> Sesuaikan path `/var/www/adcs` dengan lokasi direktori proyek
9. Install **supervisor** untuk aplikasi:
- `sudo apt install supervisor`
- `sudo chown -R www-data:www-data /var/www/`
- `nano /etc/supervisor/conf.d/adcs-supervisor.conf`
- Masukkan konfigurasi berikut:
```
[supervisord]
nodaemon=false
logfile=/dev/null
logfile_maxbytes=0
pidfile=/run/supervisord.pid
[program:adcs-cron]
process_name=%(program_name)s_%(process_num)02d
command=/root/go/bin/supercronic /root/supercronic/adcs.cron
autostart=true
autorestart=true
user=root
numprocs=1
redirect_stderr=true
stdout_logfile=/var/www/adcs/storage/logs/adcs-cron.log
stdout_logfile_maxbytes=0
stopwaitsecs=3600
[program:adcs-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /var/www/adcs/artisan queue:work database --sleep=3 --tries=3
autostart=true
autorestart=true
user=root
numprocs=8
redirect_stderr=true
stdout_logfile=/var/www/adcs/storage/logs/adcs-worker.log
stdout_logfile_maxbytes=0
stopwaitsecs=3600
[program:adcs-octane]
process_name=%(program_name)s_%(process_num)02d
command=php /var/www/adcs/artisan octane:start --max-requests=500
autostart=true
autorestart=true
user=root
numprocs=1
redirect_stderr=true
stdout_logfile=/var/www/adcs/storage/logs/adcs-octane.log
stdout_logfile_maxbytes=0
stopwaitsecs=3600
```
> Sesuaikan `/var/www/adcs` dengan lokasi direktori proyek
- `sudo supervisorctl reread`
- `sudo supervisorctl update`
- `sudo supervisorctl restart all`> #### π Informasi
> - Pastikan ekstensi PHP yang dibutuhkan Laravel `v8` sudah terpasang pada server, sesuai dokumentasi [berikut](https://laravel.com/docs/8.x/deployment)> #### π‘ Opsional
> - Untuk mempercepat performa aplikasi, jalankan `php artisan optimize` saat setelah update source code pada aplikasi> #### π Rekomendasi
> - Gunakan OS berbasis Linux (e.g. Ubuntu 20.04.3 LTS)
> - Gunakan Web Server [Nginx](https://nginx.org/en/download.html), [Apache2](https://httpd.apache.org/download.cgi), atau [LiteSpeed](https://openlitespeed.org/Downloads/)