improve local dev + contribution guide

This commit is contained in:
Andras Bacsai 2023-12-13 11:12:53 +01:00
parent f3b04c1ef9
commit 00d708610d
13 changed files with 45 additions and 28 deletions

View File

@ -22,7 +22,10 @@ ## 3) Start & setup Coolify
- Run `spin up` - You can notice that errors will be thrown. Don't worry. - Run `spin up` - You can notice that errors will be thrown. Don't worry.
- If you see weird permission errors, especially on Mac, run `sudo spin up` instead. - If you see weird permission errors, especially on Mac, run `sudo spin up` instead.
- Run `./scripts/run setup:dev` - This will generate a secret key for you, delete any existing database layouts, migrate database to the new layout, and seed your database. If you are running Coolify for the first time:
- Run `./scripts/run dev:init` - This will delete any existing database layouts, migrate database to the new layout, and seed your database.
> If you see the login page with a 404 error, you forgot to run `./scripts/run dev:init`.
### 4) Start development ### 4) Start development
You can login your Coolify instance at `localhost:8000` with `test@example.com` and `password`. You can login your Coolify instance at `localhost:8000` with `test@example.com` and `password`.
@ -31,7 +34,6 @@ ### 4) Start development
Mails are caught by Mailpit: `localhost:8025` Mails are caught by Mailpit: `localhost:8025`
## New Service Contribution ## New Service Contribution
Check out the docs [here](https://coolify.io/docs/how-to-add-a-service). Check out the docs [here](https://coolify.io/docs/how-to-add-a-service).

View File

@ -56,7 +56,7 @@ services:
ports: ports:
- "${FORWARD_SOKETI_PORT:-6001}:6001" - "${FORWARD_SOKETI_PORT:-6001}:6001"
environment: environment:
SOKETI_DEBUG: "true" SOKETI_DEBUG: "false"
SOKETI_DEFAULT_APP_ID: "${PUSHER_APP_ID:-coolify}" SOKETI_DEFAULT_APP_ID: "${PUSHER_APP_ID:-coolify}"
SOKETI_DEFAULT_APP_KEY: "${PUSHER_APP_KEY:-coolify}" SOKETI_DEFAULT_APP_KEY: "${PUSHER_APP_KEY:-coolify}"
SOKETI_DEFAULT_APP_SECRET: "${PUSHER_APP_SECRET:-coolify}" SOKETI_DEFAULT_APP_SECRET: "${PUSHER_APP_SECRET:-coolify}"
@ -115,3 +115,9 @@ volumes:
coolify-pg-data-dev: coolify-pg-data-dev:
coolify-redis-data-dev: coolify-redis-data-dev:
coolify-minio-data-dev: coolify-minio-data-dev:
networks:
coolify:
name: coolify
driver: bridge
external: false

View File

@ -2,7 +2,7 @@ FROM serversideup/php:8.2-fpm-nginx
ARG TARGETPLATFORM ARG TARGETPLATFORM
# https://github.com/cloudflare/cloudflared/releases # https://github.com/cloudflare/cloudflared/releases
ARG CLOUDFLARED_VERSION=2023.8.2 ARG CLOUDFLARED_VERSION=2023.10.0
ARG POSTGRES_VERSION=15 ARG POSTGRES_VERSION=15
RUN apt-get update RUN apt-get update

View File

@ -0,0 +1 @@
oneshot

View File

@ -0,0 +1,4 @@
#!/command/execlineb -P
foreground { composer -d /var/www/html/ install }
foreground { php /var/www/html/artisan key:generate }
foreground { php /var/www/html/artisan migrate --step }

View File

@ -15,7 +15,7 @@ FROM serversideup/php:8.2-fpm-nginx
ARG TARGETPLATFORM ARG TARGETPLATFORM
# https://github.com/cloudflare/cloudflared/releases # https://github.com/cloudflare/cloudflared/releases
ARG CLOUDFLARED_VERSION=2023.8.2 ARG CLOUDFLARED_VERSION=2023.10.0
ARG POSTGRES_VERSION=15 ARG POSTGRES_VERSION=15
WORKDIR /var/www/html WORKDIR /var/www/html

View File

@ -24,20 +24,20 @@ class="text-xs text-center text-white normal-case bg-transparent border-none rou
<form action="/login" method="POST" class="flex flex-col gap-2"> <form action="/login" method="POST" class="flex flex-col gap-2">
@csrf @csrf
@env('local') @env('local')
<x-forms.input value="test@example.com" type="email" name="email" required <x-forms.input value="test@example.com" type="email" name="email" required
label="{{ __('input.email') }}" autofocus /> label="{{ __('input.email') }}" autofocus />
<x-forms.input value="password" type="password" name="password" required <x-forms.input value="password" type="password" name="password" required
label="{{ __('input.password') }}" /> label="{{ __('input.password') }}" />
<a href="/forgot-password" class="text-xs"> <a href="/forgot-password" class="text-xs">
{{ __('auth.forgot_password') }}? {{ __('auth.forgot_password') }}?
</a> </a>
@else @else
<x-forms.input type="email" name="email" required label="{{ __('input.email') }}" autofocus /> <x-forms.input type="email" name="email" required label="{{ __('input.email') }}" autofocus />
<x-forms.input type="password" name="password" required label="{{ __('input.password') }}" /> <x-forms.input type="password" name="password" required label="{{ __('input.password') }}" />
<a href="/forgot-password" class="text-xs"> <a href="/forgot-password" class="text-xs">
{{ __('auth.forgot_password') }}? {{ __('auth.forgot_password') }}?
</a> </a>
@endenv @endenv
<x-forms.button type="submit">{{ __('auth.login') }}</x-forms.button> <x-forms.button type="submit">{{ __('auth.login') }}</x-forms.button>
@if (!$is_registration_enabled) @if (!$is_registration_enabled)

View File

@ -22,7 +22,7 @@ class="absolute inset-y-0 right-0 flex items-center pr-2 cursor-pointer hover:te
</svg> </svg>
</div> </div>
@endif @endif
<input {{ $attributes->merge(['class' => $defaultClass . ' pl-10']) }} @required($required) <input value="{{ $value }}" {{ $attributes->merge(['class' => $defaultClass . ' pl-10']) }} @required($required)
wire:model={{ $id }} wire:dirty.class.remove='text-white' wire:dirty.class="input-warning" wire:model={{ $id }} wire:dirty.class.remove='text-white' wire:dirty.class="input-warning"
wire:loading.attr="disabled" type="{{ $type }}" @readonly($readonly) @disabled($disabled) wire:loading.attr="disabled" type="{{ $type }}" @readonly($readonly) @disabled($disabled)
id="{{ $id }}" name="{{ $name }}" placeholder="{{ $attributes->get('placeholder') }}" id="{{ $id }}" name="{{ $name }}" placeholder="{{ $attributes->get('placeholder') }}"
@ -30,10 +30,11 @@ class="absolute inset-y-0 right-0 flex items-center pr-2 cursor-pointer hover:te
</div> </div>
@else @else
<input {{ $attributes->merge(['class' => $defaultClass]) }} @required($required) @readonly($readonly) <input @if($value) value="{{ $value }}" @endif {{ $attributes->merge(['class' => $defaultClass]) }} @required($required)
wire:model={{ $id }} wire:dirty.class.remove='text-white' wire:dirty.class="input-warning" @readonly($readonly) wire:model={{ $id }} wire:dirty.class.remove='text-white'
wire:loading.attr="disabled" type="{{ $type }}" @disabled($disabled) wire:dirty.class="input-warning" wire:loading.attr="disabled" type="{{ $type }}"
id="{{ $id }}" name="{{ $name }}" placeholder="{{ $attributes->get('placeholder') }}"> @disabled($disabled) id="{{ $id }}" name="{{ $name }}"
placeholder="{{ $attributes->get('placeholder') }}">
@endif @endif
@if (!$label && $helper) @if (!$label && $helper)
<x-helper :helper="$helper" /> <x-helper :helper="$helper" />

View File

@ -20,12 +20,12 @@ function help {
compgen -A function | cat -n compgen -A function | cat -n
} }
function setup:dev { function dev:init {
docker exec coolify bash -c "composer install" docker exec coolify bash -c "php artisan migrate --seed"
docker exec coolify bash -c "php artisan key:generate" echo "Need to update privileges on a few files. I need your password for that."
docker exec coolify bash -c "php artisan migrate:fresh --seed"
sudo chmod -R o+rwx . sudo chmod -R o+rwx .
} }
function sync:v3 { function sync:v3 {
if [ -z "$1" ]; then if [ -z "$1" ]; then
echo -e "Please provide a version.\n\nExample: run sync:v3 3.12.32" echo -e "Please provide a version.\n\nExample: run sync:v3 3.12.32"
@ -57,9 +57,12 @@ function schedule:run {
function db { function db {
bash spin exec -u webuser coolify php artisan db bash spin exec -u webuser coolify php artisan db
} }
function db:seed {
bash spin exec -u webuser coolify php artisan migrate --seed
}
function db:migrate { function db:migrate {
bash spin exec -u webuser coolify php artisan migrate bash spin exec -u webuser coolify php artisan migrate --step
} }
function db:reset { function db:reset {