Extend typings

This commit is contained in:
Andras Bacsai 2022-04-06 17:18:25 +02:00
parent a7ed3e58db
commit d18bb9cc74
3 changed files with 9 additions and 11 deletions

View File

@ -20,12 +20,9 @@ import {
setDefaultConfiguration
} from '$lib/buildPacks/common';
import yaml from 'js-yaml';
import type { ComposeFile } from '$lib/types/composeFile';
export default async function (job) {
/*
Edge cases:
1 - Change build pack and redeploy, what should happen?
*/
let {
id: applicationId,
repository,
@ -274,7 +271,7 @@ export default async function (job) {
}
};
});
const compose = {
const composeFile: ComposeFile = {
version: '3.8',
services: {
[imageId]: {
@ -283,7 +280,7 @@ export default async function (job) {
volumes,
env_file: envFound ? [`${workdir}/.env`] : [],
networks: [docker.network],
labels: labels,
labels,
depends_on: [],
restart: 'always'
}
@ -295,7 +292,7 @@ export default async function (job) {
},
volumes: Object.assign({}, ...composeVolumes)
};
await fs.writeFile(`${workdir}/docker-compose.yml`, yaml.dump(compose));
await fs.writeFile(`${workdir}/docker-compose.yml`, yaml.dump(composeFile));
await asyncExecShell(
`DOCKER_HOST=${host} docker compose --project-directory ${workdir} up -d`
);

View File

@ -1,5 +1,3 @@
import { makeLabelForServices } from '../buildPacks/common';
export type ComposeFile = {
version: ComposerFileVersion;
services: Record<string, ComposeFileService>;
@ -11,10 +9,12 @@ export type ComposeFileService = {
container_name: string;
image?: string;
networks: string[];
environment: Record<string, unknown>;
environment?: Record<string, unknown>;
volumes?: string[];
ulimits?: unknown;
labels?: string[];
env_file?: string[];
extra_hosts?: string[];
restart: ComposeFileRestartOption;
depends_on?: string[];
command?: string;

View File

@ -4,6 +4,7 @@ import { decrypt, encrypt } from '$lib/crypto';
import * as db from '$lib/database';
import { generateDatabaseConfiguration, ErrorHandler, generatePassword } from '$lib/database';
import { checkContainer, startTcpProxy, stopTcpHttpProxy } from '$lib/haproxy';
import type { ComposeFile } from '$lib/types/composeFile';
import type { RequestHandler } from '@sveltejs/kit';
import cuid from 'cuid';
import fs from 'fs/promises';
@ -108,7 +109,7 @@ export const post: RequestHandler = async (event) => {
}/${id}.sh:/etc/sftp.d/chmod.sh`
];
const compose = {
const compose: ComposeFile = {
version: '3.8',
services: {
[`${id}-ftp`]: {