feat: Use compose instead of normal docker cmd
This commit is contained in:
@@ -52,8 +52,7 @@ export const post: RequestHandler = async (event) => {
|
||||
buildCommand,
|
||||
startCommand,
|
||||
baseDirectory,
|
||||
publishDirectory,
|
||||
phpModules
|
||||
publishDirectory
|
||||
} = await event.request.json();
|
||||
|
||||
if (port) port = Number(port);
|
||||
@@ -69,8 +68,7 @@ export const post: RequestHandler = async (event) => {
|
||||
buildCommand,
|
||||
startCommand,
|
||||
baseDirectory,
|
||||
publishDirectory,
|
||||
phpModules
|
||||
publishDirectory
|
||||
});
|
||||
return { status: 201 };
|
||||
} catch (error) {
|
||||
|
||||
@@ -47,125 +47,7 @@
|
||||
import { post } from '$lib/api';
|
||||
import cuid from 'cuid';
|
||||
import { browser } from '$app/env';
|
||||
import Select from 'svelte-select';
|
||||
const { id } = $page.params;
|
||||
let collection = [
|
||||
'amqp',
|
||||
'apcu',
|
||||
'apcu_bc',
|
||||
'ast',
|
||||
'bcmath',
|
||||
'blackfire',
|
||||
'bz2',
|
||||
'calendar',
|
||||
'cmark',
|
||||
'csv',
|
||||
'dba',
|
||||
'decimal',
|
||||
'ds',
|
||||
'enchant',
|
||||
'ev',
|
||||
'event',
|
||||
'excimer',
|
||||
'exif',
|
||||
'ffi',
|
||||
'gd',
|
||||
'gearman',
|
||||
'geoip',
|
||||
'geospatial',
|
||||
'gettext',
|
||||
'gmagick',
|
||||
'gmp',
|
||||
'gnupg',
|
||||
'grpc',
|
||||
'http',
|
||||
'igbinary',
|
||||
'imagick',
|
||||
'imap',
|
||||
'inotify',
|
||||
'interbase',
|
||||
'intl',
|
||||
'ioncube_loader',
|
||||
'jsmin',
|
||||
'json_post',
|
||||
'ldap',
|
||||
'lzf',
|
||||
'mailparse',
|
||||
'maxminddb',
|
||||
'mcrypt',
|
||||
'memcache',
|
||||
'memcached',
|
||||
'mongo',
|
||||
'mongodb',
|
||||
'mosquitto',
|
||||
'msgpack',
|
||||
'mssql',
|
||||
'mysqli',
|
||||
'oauth',
|
||||
'oci8',
|
||||
'odbc',
|
||||
'opcache',
|
||||
'opencensus',
|
||||
'openswoole',
|
||||
'parallel',
|
||||
'pcntl',
|
||||
'pcov',
|
||||
'pdo_dblib',
|
||||
'pdo_firebird',
|
||||
'pdo_mysql',
|
||||
'pdo_oci',
|
||||
'pdo_odbc',
|
||||
'pdo_pgsql',
|
||||
'pdo_sqlsrv',
|
||||
'pgsql',
|
||||
'propro',
|
||||
'protobuf',
|
||||
'pspell',
|
||||
'pthreads',
|
||||
'raphf',
|
||||
'rdkafka',
|
||||
'recode',
|
||||
'redis',
|
||||
'seaslog',
|
||||
'shmop',
|
||||
'smbclient',
|
||||
'snmp',
|
||||
'snuffleupagus',
|
||||
'soap',
|
||||
'sockets',
|
||||
'solr',
|
||||
'sourceguardian',
|
||||
'spx',
|
||||
'sqlsrv',
|
||||
'ssh2',
|
||||
'stomp',
|
||||
'swoole',
|
||||
'sybase_ct',
|
||||
'sysvmsg',
|
||||
'sysvsem',
|
||||
'sysvshm',
|
||||
'tensor',
|
||||
'tidy',
|
||||
'timezonedb',
|
||||
'uopz',
|
||||
'uploadprogress',
|
||||
'uuid',
|
||||
'vips',
|
||||
'wddx',
|
||||
'xdebug',
|
||||
'xhprof',
|
||||
'xlswriter',
|
||||
'xmldiff',
|
||||
'xmlrpc',
|
||||
'xsl',
|
||||
'yac',
|
||||
'yaml',
|
||||
'yar',
|
||||
'zephir_parser',
|
||||
'zip',
|
||||
'zookeeper',
|
||||
'zstd'
|
||||
];
|
||||
|
||||
let domainEl: HTMLInputElement;
|
||||
|
||||
@@ -225,9 +107,8 @@
|
||||
async function handleSubmit() {
|
||||
loading = true;
|
||||
try {
|
||||
const tempPhpModules = application.phpModules?.map((module) => module.value).toString() || '';
|
||||
await post(`/applications/${id}/check.json`, { fqdn: application.fqdn, forceSave });
|
||||
await post(`/applications/${id}.json`, { ...application, phpModules: tempPhpModules });
|
||||
await post(`/applications/${id}.json`, { ...application });
|
||||
return window.location.reload();
|
||||
} catch ({ error }) {
|
||||
if (error.startsWith('DNS not set')) {
|
||||
@@ -481,19 +362,6 @@
|
||||
/>
|
||||
</div>
|
||||
{/if}
|
||||
<!-- {#if application.buildPack === 'php'}
|
||||
<div class="grid grid-cols-2 items-center">
|
||||
<label for="startCommand" class="text-base font-bold text-stone-100">PHP Modules</label>
|
||||
<div class="svelte-select">
|
||||
<Select
|
||||
isMulti={true}
|
||||
bind:value={application.phpModules}
|
||||
items={collection}
|
||||
placeholder="Select PHP modules to add..."
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
{/if} -->
|
||||
<div class="grid grid-cols-2 items-center">
|
||||
<div class="flex-col">
|
||||
<label for="baseDirectory" class="pt-2 text-base font-bold text-stone-100"
|
||||
|
||||
@@ -6,17 +6,31 @@
|
||||
};
|
||||
import { del, post } from '$lib/api';
|
||||
import { page } from '$app/stores';
|
||||
import { createEventDispatcher } from 'svelte';
|
||||
|
||||
import { errorNotification } from '$lib/form';
|
||||
import { toast } from '@zerodevx/svelte-toast';
|
||||
const { id } = $page.params;
|
||||
|
||||
async function saveStorage() {
|
||||
const dispatch = createEventDispatcher();
|
||||
async function saveStorage(newStorage = false) {
|
||||
try {
|
||||
if (!storage.path) return errorNotification('Path is required.');
|
||||
storage.path = storage.path.startsWith('/') ? storage.path : `/${storage.path}`;
|
||||
storage.path = storage.path.endsWith('/') ? storage.path.slice(0, -1) : storage.path;
|
||||
storage.path.replace(/\/\//g, '/');
|
||||
await post(`/applications/${id}/storage.json`, {
|
||||
path: storage.path
|
||||
path: storage.path,
|
||||
storageId: storage.id,
|
||||
newStorage
|
||||
});
|
||||
dispatch('refresh');
|
||||
if (isNew) {
|
||||
storage.path = null;
|
||||
storage.id = null;
|
||||
}
|
||||
if (newStorage) toast.push('Storage saved.');
|
||||
else toast.push('Storage updated.');
|
||||
} catch ({ error }) {
|
||||
return errorNotification(error);
|
||||
}
|
||||
@@ -24,6 +38,8 @@
|
||||
async function removeStorage() {
|
||||
try {
|
||||
await del(`/applications/${id}/storage.json`, { path: storage.path });
|
||||
dispatch('refresh');
|
||||
toast.push('Storage deleted.');
|
||||
} catch ({ error }) {
|
||||
return errorNotification(error);
|
||||
}
|
||||
@@ -32,7 +48,6 @@
|
||||
|
||||
<td>
|
||||
<input
|
||||
readonly={!isNew}
|
||||
bind:value={storage.path}
|
||||
required
|
||||
placeholder="eg: /sqlite.db"
|
||||
@@ -40,10 +55,19 @@
|
||||
/>
|
||||
</td>
|
||||
<td>
|
||||
<div class="flex items-center justify-center px-2">
|
||||
<button class="bg-green-600 hover:bg-green-500" on:click={saveStorage}>Add</button>
|
||||
</div>
|
||||
<div class="flex items-center justify-center px-2">
|
||||
<button class="bg-green-600 hover:bg-green-500" on:click={removeStorage}>Remove</button>
|
||||
</div>
|
||||
{#if isNew}
|
||||
<div class="flex items-center justify-center">
|
||||
<button class="bg-green-600 hover:bg-green-500" on:click={() => saveStorage(true)}>Add</button
|
||||
>
|
||||
</div>
|
||||
{:else}
|
||||
<div class="flex flex-row justify-center space-x-2">
|
||||
<div class="flex items-center justify-center">
|
||||
<button class="" on:click={() => saveStorage(false)}>Set</button>
|
||||
</div>
|
||||
<div class="flex justify-center items-end">
|
||||
<button class="bg-red-600 hover:bg-red-500" on:click={removeStorage}>Remove</button>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
</td>
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
import { getTeam, getUserDetails } from '$lib/common';
|
||||
import { getUserDetails } from '$lib/common';
|
||||
import * as db from '$lib/database';
|
||||
import { ErrorHandler } from '$lib/database';
|
||||
import { dockerInstance } from '$lib/docker';
|
||||
import type { RequestHandler } from '@sveltejs/kit';
|
||||
import jsonwebtoken from 'jsonwebtoken';
|
||||
|
||||
export const get: RequestHandler = async (event) => {
|
||||
const { status, body, teamId } = await getUserDetails(event, false);
|
||||
@@ -27,11 +25,18 @@ export const post: RequestHandler = async (event) => {
|
||||
if (status === 401) return { status, body };
|
||||
|
||||
const { id } = event.params;
|
||||
const { path } = await event.request.json();
|
||||
const { path, newStorage, storageId } = await event.request.json();
|
||||
try {
|
||||
await db.prisma.applicationPersistentStorage.create({
|
||||
data: { path, application: { connect: { id } } }
|
||||
});
|
||||
if (newStorage) {
|
||||
await db.prisma.applicationPersistentStorage.create({
|
||||
data: { path, application: { connect: { id } } }
|
||||
});
|
||||
} else {
|
||||
await db.prisma.applicationPersistentStorage.update({
|
||||
where: { id: storageId },
|
||||
data: { path }
|
||||
});
|
||||
}
|
||||
return {
|
||||
status: 201
|
||||
};
|
||||
|
||||
@@ -26,8 +26,13 @@
|
||||
import { getDomain } from '$lib/components/common';
|
||||
import { page } from '$app/stores';
|
||||
import Storage from './_Storage.svelte';
|
||||
import { get } from '$lib/api';
|
||||
|
||||
const { id } = $page.params;
|
||||
async function refreshStorage() {
|
||||
const data = await get(`/applications/${id}/storage.json`);
|
||||
persistentStorages = [...data.persistentStorages];
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="flex space-x-1 p-6 font-bold">
|
||||
@@ -49,12 +54,12 @@
|
||||
{#each persistentStorages as storage}
|
||||
{#key storage.id}
|
||||
<tr>
|
||||
<Storage {storage} />
|
||||
<Storage on:refresh={refreshStorage} {storage} />
|
||||
</tr>
|
||||
{/key}
|
||||
{/each}
|
||||
<tr>
|
||||
<Storage isNew />
|
||||
<Storage on:refresh={refreshStorage} isNew />
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
Reference in New Issue
Block a user