Skip to content

Commit

Permalink
- upgrade to laravel 10
Browse files Browse the repository at this point in the history
  • Loading branch information
xterm-inator committed Nov 9, 2023
1 parent 2d0f592 commit f657440
Show file tree
Hide file tree
Showing 34 changed files with 1,735 additions and 2,991 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ RUN composer install \
--prefer-dist

#Image
FROM phpswoole/swoole:5.0-php8.1-alpine as base
FROM phpswoole/swoole:5.0-php8.2-alpine as base
LABEL authors="David Smith <[email protected]>"

RUN docker-php-ext-install bcmath && \
Expand Down
4 changes: 2 additions & 2 deletions LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,7 @@ to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.

<one line to give the program's name and a brief idea of what it does.>
MicroGuard web-based management tool for handling WireGuard clients on MikroTik routers.
Copyright (C) 2023 David Smith

This program is free software: you can redistribute it and/or modify
Expand All @@ -652,7 +652,7 @@ Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:

<program> Copyright (C) 2023 David Smith
MicroGuard Copyright (C) 2023 David Smith
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
Expand Down
44 changes: 30 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ MicroGuard is a robust web-based management tool designed to streamline the hand
- **Access Control**: Easily grant or revoke access for individual clients.
- **Google SSO**: Secure sign-in using Google's Single Sign-On system.

> **Note**: Comprehensive SSO setup details will be provided soon.
## Requirements

- MikroTik router with RouterOS version 7.0 or newer.
Expand Down Expand Up @@ -97,15 +95,15 @@ docker run -d
-e ROUTEROS_WIREGUARD_INTERFACE='wireguard' #wireguard interface name
-e ROUTEROS_WIREGUARD_ENDPOINT='192.168.0.1:13231' #ip:port for wireguard interface
-e APP_URL='https://my.public.address'
ghcr.io/xterm-inator/microguard:master
ghcr.io/xterm-inator/microguard:latest
````

**Docker Compose**:
```yml
version: '3.8'
services:
microguard:
image: ghcr.io/xterm-inator/microguard:master
image: ghcr.io/xterm-inator/microguard:latest
container_name: microguard
restart: always
ports:
Expand Down Expand Up @@ -146,34 +144,52 @@ To facilitate local development and testing, we've incorporated Docker Compose.
1. Clone the Repository:
Use Git to clone the MicroGuard repository to your local machine:
```bash
git clone https://github.com/your-repo-link/microguard.git
git clone git@github.com:xterm-inator/microguard.git
# Navigate into the repository directory:
cd microguard
```
2. Set Up Environment Variables:
Before starting the services using Docker Compose, you may need to configure some environment variables. Copy the sample environment file and adjust the settings as necessary:
```shell
```bash
cp api/.env.example .env
```
Edit the .env file with appropriate values. Make sure to generate and set values for necessary keys, especially those related to Google SSO, and MikroTik configurations.
Edit the .env file with appropriate values. Make sure to generate and set values for necessary keys.
3. Build Containers:
```bash
docker compose build --parallel
```
4. Install Dependencies:
Using docker run there are some dependencies that need to be setup:
```bash
docker compose run api composer install
docker compose run api npm i
docker compose run api php artisan key:generate
docker compose run api php artisan migrate
docker compose run vue npm i
```
5. Create an Initial User:
```bash
docker compose run api php artisan app:create-user [email protected] admin
```
3. Run with Docker Compose:
6. Run with Docker Compose:
Start the MicroGuard stack using Docker Compose:
```shell
```bash
docker compose up
```
This will build and start all necessary containers. Once done, the MicroGuard interface should be accessible at http://localhost:8000 or another port if you've adjusted the configuration.
This will build and start all necessary containers. Once done, the MicroGuard interface should be accessible at http://localhost:3000.
4. Shutdown and Cleanup:
7. Shutdown and Cleanup:
When you're done with local development/testing, you can stop the Docker Compose services:

```shell
```bash
docker compose down
```

This setup should provide an isolated environment for development and testing without affecting any production data or configurations.
## Contributing
Contribute to MicroGuard by submitting a pull request or issue on GitHub. We welcome bug reports, feature suggestions, and code enhancements from the community.

Expand Down
59 changes: 9 additions & 50 deletions api/.env.example
Original file line number Diff line number Diff line change
@@ -1,58 +1,17 @@
APP_NAME=Laravel
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost

LOG_CHANNEL=stack
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=api
DB_USERNAME=root
DB_PASSWORD=

BROADCAST_DRIVER=log
CACHE_DRIVER=file
FILESYSTEM_DISK=local
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120

MEMCACHED_HOST=127.0.0.1

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_MAILER=smtp
MAIL_HOST=mailhog
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS="[email protected]"
MAIL_FROM_NAME="${APP_NAME}"

AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
AWS_USE_PATH_STYLE_ENDPOINT=false
ROUTEROS_HOST=192.168.0.1
ROUTEROS_PORT=8728
ROUTEROS_USER=wireguard
ROUTEROS_PASS=wireguard-pass

PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_HOST=
PUSHER_PORT=443
PUSHER_SCHEME=https
PUSHER_APP_CLUSTER=mt1
ROUTEROS_WIREGUARD_INTERFACE=wireguard
ROUTEROS_WIREGUARD_ENDPOINT=192.168.0.1:13231

VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
VITE_PUSHER_HOST="${PUSHER_HOST}"
VITE_PUSHER_PORT="${PUSHER_PORT}"
VITE_PUSHER_SCHEME="${PUSHER_SCHEME}"
VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=
GOOGLE_REDIRECT_URL=http://localhost:8000/api/auth/oauth/google/callback
30 changes: 4 additions & 26 deletions api/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,35 +1,13 @@
FROM phpswoole/swoole:5.0-php8.1-alpine

## Set to keep file permissions same as host for mounted volume
#RUN useradd -m -u 1000 user

#RUN apt-get update && apt-get install -y \
# default-mysql-client \
# git \
# libzip-dev \
FROM phpswoole/swoole:5.0-php8.2-alpine

RUN apk add --no-cache \
linux-headers \
nodejs \
npm

RUN docker-php-ext-install bcmath && \
docker-php-ext-install sockets

# Install Composer
#RUN apt-get install -y curl && \
# curl -sS https://getcomposer.org/installer | php && \
# mv composer.phar /usr/local/bin/composer && \
# composer self-update && \
# apt-get remove --purge curl -y && \
# apt-get clean

# Configure PHP
#RUN echo "php_admin_flag[log_errors] = On">>/usr/local/etc/php-fpm.conf
#COPY ./docker/php/xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini

# Install Xdebug
#RUN pecl install xdebug && \
# docker-php-ext-enable xdebug
docker-php-ext-install sockets && \
docker-php-ext-install pcntl

WORKDIR /var/www

Expand Down
2 changes: 1 addition & 1 deletion api/app/Http/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class Kernel extends HttpKernel
*
* @var array<string, class-string|string>
*/
protected $routeMiddleware = [
protected $middlewareAliases = [
'auth' => \App\Http\Middleware\Authenticate::class,
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
'auth.session' => \Illuminate\Session\Middleware\AuthenticateSession::class,
Expand Down
2 changes: 0 additions & 2 deletions api/app/Providers/AuthServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ class AuthServiceProvider extends ServiceProvider
*/
public function boot()
{
$this->registerPolicies();

Gate::define('list-roles', fn (User $user) => $user->role === Role::Admin);
}
}
14 changes: 7 additions & 7 deletions api/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
"keywords": ["framework", "laravel"],
"license": "MIT",
"require": {
"php": "^8.1",
"php": "^8.2",
"ext-sodium": "*",
"evilfreelancer/routeros-api-php": "^1.4",
"guzzlehttp/guzzle": "^7.2",
"laravel/framework": "^9.19",
"laravel/framework": "^10",
"laravel/octane": "^1.3",
"laravel/sanctum": "^3.0",
"laravel/sanctum": "^3.2",
"laravel/socialite": "^5.5",
"laravel/tinker": "^2.7",
"s1lentium/iptools": "^1.1"
Expand All @@ -22,9 +22,9 @@
"laravel/sail": "^1.0.1",
"laravel/telescope": "^4.9",
"mockery/mockery": "^1.4.4",
"nunomaduro/collision": "^6.1",
"phpunit/phpunit": "^9.5.10",
"spatie/laravel-ignition": "^1.0"
"nunomaduro/collision": "^7.0",
"phpunit/phpunit": "^10.0",
"spatie/laravel-ignition": "^2.0"
},
"autoload": {
"psr-4": {
Expand Down Expand Up @@ -71,6 +71,6 @@
"pestphp/pest-plugin": true
}
},
"minimum-stability": "dev",
"minimum-stability": "stable",
"prefer-stable": true
}
Loading

0 comments on commit f657440

Please sign in to comment.