Skip to content

Commit

Permalink
Separated laravel app to its own folder (#540)
Browse files Browse the repository at this point in the history
  • Loading branch information
JhumanJ authored Aug 26, 2024
1 parent 39b8df5 commit 5bd1dda
Show file tree
Hide file tree
Showing 546 changed files with 124 additions and 143 deletions.
8 changes: 0 additions & 8 deletions .babelrc

This file was deleted.

35 changes: 23 additions & 12 deletions .github/workflows/laravel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@ name: laravel

on:
push:
branches: [ main ]
branches: [main]
pull_request:

jobs:

code_lint:
runs-on: ubuntu-latest
name: Run code linters
Expand Down Expand Up @@ -36,15 +35,19 @@ jobs:
coverage: none

- name: Prepare the environment
working-directory: ./api
run: cp .env.example .env

- name: Install composer dependencies
working-directory: ./api
run: composer install --prefer-dist --no-interaction --no-progress --ignore-platform-reqs --optimize-autoloader

- name: Directory permissions
working-directory: ./api
run: chmod -R 777 storage bootstrap/cache

- name: Run PHP lint check
working-directory: ./api
run: ./vendor/bin/pint --test

tests:
Expand Down Expand Up @@ -90,8 +93,8 @@ jobs:
strategy:
fail-fast: true
matrix:
php: [ 8.2 ]
connection: [ pgsql, mysql ]
php: [8.2]
connection: [pgsql, mysql]
include:
- connection: pgsql
host: localhost
Expand All @@ -100,7 +103,7 @@ jobs:
password: postgres
database: postgres
- connection: mysql
host: '127.0.0.1'
host: "127.0.0.1"
port: 3306
user: root
password: test
Expand Down Expand Up @@ -133,12 +136,14 @@ jobs:
coverage: none

- name: Prepare the environment
run: cp .env.example .env
run: cp api/.env.example api/.env

- name: Install composer dependencies
working-directory: ./api
run: composer install --prefer-dist --no-interaction --no-progress --ignore-platform-reqs --optimize-autoloader

- name: Directory permissions
working-directory: ./api
run: chmod -R 777 storage bootstrap/cache

- name: Run tests (Unit and Feature)
Expand All @@ -154,6 +159,7 @@ jobs:
- name: "Archive log results"
if: always()
uses: actions/upload-artifact@v3
working-directory: ./api
with:
name: log results
path: storage/logs/laravel.log
Expand All @@ -163,16 +169,16 @@ jobs:
runs-on: ubuntu-latest
name: Build the Nuxt app
defaults:
run:
working-directory: ./client
run:
working-directory: ./client
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Node.js
uses: actions/setup-node@v1
with:
node-version: '20'
node-version: "20"

- uses: actions/cache@v2
with:
Expand All @@ -193,7 +199,7 @@ jobs:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}

production-deploy:
needs: [ code_lint, tests, build-nuxt-app ]
needs: [code_lint, tests, build-nuxt-app]
if: success() && github.ref == 'refs/heads/main' && github.event_name == 'push'
runs-on: ubuntu-latest
name: Triggers Deployment (Vapor & Amplify)
Expand Down Expand Up @@ -230,24 +236,29 @@ jobs:
coverage: none

- name: Prepare the environment
working-directory: ./api
run: cp .env.example .env

- name: Install composer dependencies
working-directory: ./api
run: composer install --prefer-dist --no-interaction --no-progress --ignore-platform-reqs --optimize-autoloader

- name: Directory permissions
working-directory: ./api
run: chmod -R 777 storage bootstrap/cache

- name: Trigger front-end deployment
run: |
run: |
URL="${{ secrets.AMPLIFY_DEPLOY_URL }}"
curl -X POST -d {} "$URL" -H "Content-Type: application/json"
- name: Created encrypted .env file before deployment
working-directory: ./api
run: |
echo "${{ secrets.ENCRYPTED_ENV_FILE }}" >> .env.production.encrypted
echo "${{ secrets.ENCRYPTED_ENV_FILE }}" >> .env.production.encrypted
- name: Deploy back-end to production
working-directory: ./api
run: php vendor/bin/vapor deploy api-production --commit="${GITHUB_SHA}" --message="${GITHUB_REF}"
env:
VAPOR_API_TOKEN: ${{ secrets.VAPOR_API_TOKEN }}
22 changes: 0 additions & 22 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,33 +1,11 @@
/node_modules
/public/hot
/public/storage
/storage/*.key
/storage/clockwork
/vendor
.env
.env.production
.env.api-production
.env.backup
.env.testing
.env.dusk.local
.env.api-*
.phpunit.result.cache
.idea/*
Homestead.json
Homestead.yaml
npm-debug.log
yarn-error.log
phpunit.dusk.xml
/public/dist
/public/build
/public/mix-manifest.json
/public/sitemap.xml
.DS_Store
public/.DS_Store
*.DS_Store
.vapor/
.env.production
.env.staging
_ide_helper.php
docker-compose.override.yml
/.make.*
13 changes: 0 additions & 13 deletions .styleci.yml

This file was deleted.

18 changes: 3 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,19 +103,6 @@ OpnForm can be easily set up using Docker. Pre-built images are available on Doc
#### Quick Start

1. Clone the repository:
<<<<<<< HEAD

```
git clone https://github.com/JhumanJ/OpnForm.git
cd OpnForm
```

2. Set up environment files:

```
cp .env.docker .env
cp client/.env.docker client/.env
=======

```
git clone https://github.com/JhumanJ/OpnForm.git
Expand All @@ -126,7 +113,6 @@ OpnForm can be easily set up using Docker. Pre-built images are available on Doc

```bash
./scripts/setup-env.sh --docker
>>>>>>> 0a9400492674212cdabcd4821ee87483b28735e5
```

3. Start the application:
Expand Down Expand Up @@ -177,7 +163,7 @@ For development or customization, you can build the Docker images locally:
2. Create a docker-compose override file:

```
cp docker-compose.override.yml.example docker-compose.override.yml
touch docker-compose.override.yml
```

Edit the `docker-compose.override.yml` file to use your locally built images:
Expand All @@ -188,6 +174,8 @@ For development or customization, you can build the Docker images locally:
image: opnform-api:local
ui:
image: opnform-ui:local
api-worker:
image: opnform-api:local
```

3. Start the application:
Expand Down
6 changes: 3 additions & 3 deletions .env.docker → api/.env.docker
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ SESSION_LIFETIME=120
MAIL_MAILER=log
MAIL_HOST=
MAIL_PORT=
MAIL_USERNAME=
MAIL_USERNAME=[email protected]
MAIL_PASSWORD=
MAIL_ENCRYPTION=
MAIL_FROM_ADDRESS=
MAIL_FROM_NAME=
MAIL_FROM_ADDRESS=[email protected]
MAIL_FROM_NAME=OpnForm

AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
Expand Down
File renamed without changes.
34 changes: 34 additions & 0 deletions api/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/node_modules
/public/hot
/public/storage
/storage/*.key
/storage/clockwork
/vendor
.env
.env.production
.env.api-production
.env.backup
.env.testing
.env.dusk.local
.env.api-*
.env.docker.local
.phpunit.result.cache
.idea/*
Homestead.json
Homestead.yaml
npm-debug.log
yarn-error.log
phpunit.dusk.xml
/public/dist
/public/build
/public/mix-manifest.json
/public/sitemap.xml
.DS_Store
public/.DS_Store
*.DS_Store
.vapor/
.env.production
.env.staging
_ide_helper.php
docker-compose.override.yml
/.make.*
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
21 changes: 21 additions & 0 deletions api/app/helpers.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

if (!function_exists('front_url')) {
function front_url($path = '')
{
$baseUrl = config('app.front_url') ?? config('app.url');
\Log::info('Base URL for front-end: ' . $baseUrl);
if (! $baseUrl) {
return $path;
}

return rtrim($baseUrl, '/') . '/' . ltrim($path, '/');
}
}

if (!function_exists('pricing_enabled')) {
function pricing_enabled(): bool
{
return App::environment() !== 'testing' && !is_null(config('cashier.key'));
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion config/filesystems.php → api/config/filesystems.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
'public' => [
'driver' => 'local',
'root' => storage_path('app/public'),
'url' => env('APP_URL').'/storage',
'url' => env('APP_URL') . '/storage',
'visibility' => 'public',
],

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 5bd1dda

Please sign in to comment.