Skip to content

Commit

Permalink
Merge pull request #199 from coollabsio/fixes
Browse files Browse the repository at this point in the history
v2.0.23
  • Loading branch information
andrasbacsai authored Feb 28, 2022
2 parents 716aa36 + 88b3910 commit b9da68e
Show file tree
Hide file tree
Showing 21 changed files with 43 additions and 20 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "coolify",
"description": "An open-source & self-hostable Heroku / Netlify alternative.",
"version": "2.0.22",
"version": "2.0.23",
"license": "AGPL-3.0",
"scripts": {
"dev": "docker-compose -f docker-compose-dev.yaml up -d && NODE_ENV=development svelte-kit dev --host 0.0.0.0",
Expand Down
1 change: 1 addition & 0 deletions src/lib/buildPacks/gatsby.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const createDockerfile = async (data, imageforBuild): Promise<void> => {

Dockerfile.push(`FROM ${imageforBuild}`);
Dockerfile.push('WORKDIR /usr/share/nginx/html');
Dockerfile.push(`LABEL coolify.image=true`);
Dockerfile.push(`COPY --from=${applicationId}:${tag}-cache /usr/src/app/${publishDirectory} ./`);
Dockerfile.push(`EXPOSE 80`);
Dockerfile.push('CMD ["nginx", "-g", "daemon off;"]');
Expand Down
1 change: 1 addition & 0 deletions src/lib/buildPacks/nestjs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const createDockerfile = async (data, image): Promise<void> => {

Dockerfile.push(`FROM ${image}`);
Dockerfile.push('WORKDIR /usr/src/app');
Dockerfile.push(`LABEL coolify.image=true`);
Dockerfile.push(
`COPY --from=${applicationId}:${tag}-cache /usr/src/app/${baseDirectory || ''} ./`
);
Expand Down
1 change: 1 addition & 0 deletions src/lib/buildPacks/nextjs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const createDockerfile = async (data, image): Promise<void> => {

Dockerfile.push(`FROM ${image}`);
Dockerfile.push('WORKDIR /usr/src/app');
Dockerfile.push(`LABEL coolify.image=true`);
if (secrets.length > 0) {
secrets.forEach((secret) => {
if (secret.isBuildSecret) {
Expand Down
1 change: 1 addition & 0 deletions src/lib/buildPacks/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const createDockerfile = async (data, image): Promise<void> => {

Dockerfile.push(`FROM ${image}`);
Dockerfile.push('WORKDIR /usr/src/app');
Dockerfile.push(`LABEL coolify.image=true`);
if (secrets.length > 0) {
secrets.forEach((secret) => {
if (secret.isBuildSecret) {
Expand Down
1 change: 1 addition & 0 deletions src/lib/buildPacks/nuxtjs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const createDockerfile = async (data, image): Promise<void> => {

Dockerfile.push(`FROM ${image}`);
Dockerfile.push('WORKDIR /usr/src/app');
Dockerfile.push(`LABEL coolify.image=true`);
if (secrets.length > 0) {
secrets.forEach((secret) => {
if (secret.isBuildSecret) {
Expand Down
1 change: 1 addition & 0 deletions src/lib/buildPacks/php.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const createDockerfile = async (data, image): Promise<void> => {
const Dockerfile: Array<string> = [];

Dockerfile.push(`FROM ${image}`);
Dockerfile.push(`LABEL coolify.image=true`);
Dockerfile.push('RUN a2enmod rewrite');
Dockerfile.push('WORKDIR /var/www/html');
Dockerfile.push(`COPY ./${baseDirectory || ''} /var/www/html`);
Expand Down
1 change: 1 addition & 0 deletions src/lib/buildPacks/react.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const createDockerfile = async (data, image): Promise<void> => {
const Dockerfile: Array<string> = [];

Dockerfile.push(`FROM ${image}`);
Dockerfile.push(`LABEL coolify.image=true`);
Dockerfile.push('WORKDIR /usr/share/nginx/html');
Dockerfile.push(`COPY --from=${applicationId}:${tag}-cache /usr/src/app/${publishDirectory} ./`);
Dockerfile.push(`EXPOSE 80`);
Expand Down
1 change: 1 addition & 0 deletions src/lib/buildPacks/rust.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const createDockerfile = async (data, image, name): Promise<void> => {
const Dockerfile: Array<string> = [];
Dockerfile.push(`FROM ${image}`);
Dockerfile.push('WORKDIR /usr/src/app');
Dockerfile.push(`LABEL coolify.image=true`);
Dockerfile.push(`COPY --from=${applicationId}:${tag}-cache /usr/src/app/target target`);
Dockerfile.push(`COPY --from=${applicationId}:${tag}-cache /usr/local/cargo /usr/local/cargo`);
Dockerfile.push(`COPY . .`);
Expand Down
1 change: 1 addition & 0 deletions src/lib/buildPacks/static.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const createDockerfile = async (data, image): Promise<void> => {

Dockerfile.push(`FROM ${image}`);
Dockerfile.push('WORKDIR /usr/share/nginx/html');
Dockerfile.push(`LABEL coolify.image=true`);
if (secrets.length > 0) {
secrets.forEach((secret) => {
if (secret.isBuildSecret) {
Expand Down
1 change: 1 addition & 0 deletions src/lib/buildPacks/svelte.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const createDockerfile = async (data, image): Promise<void> => {

Dockerfile.push(`FROM ${image}`);
Dockerfile.push('WORKDIR /usr/share/nginx/html');
Dockerfile.push(`LABEL coolify.image=true`);
Dockerfile.push(`COPY --from=${applicationId}:${tag}-cache /usr/src/app/${publishDirectory} ./`);
Dockerfile.push(`EXPOSE 80`);
Dockerfile.push('CMD ["nginx", "-g", "daemon off;"]');
Expand Down
1 change: 1 addition & 0 deletions src/lib/buildPacks/vuejs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const createDockerfile = async (data, image): Promise<void> => {

Dockerfile.push(`FROM ${image}`);
Dockerfile.push('WORKDIR /usr/share/nginx/html');
Dockerfile.push(`LABEL coolify.image=true`);
Dockerfile.push(`COPY --from=${applicationId}:${tag}-cache /usr/src/app/${publishDirectory} ./`);
Dockerfile.push(`EXPOSE 80`);
Dockerfile.push('CMD ["nginx", "-g", "daemon off;"]');
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/templates.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
function defaultBuildAndDeploy(packageManager) {
return {
installCommand:
packageManager === 'npm' ? `${packageManager} run install` : `${packageManager} install`,
packageManager === 'npm' ? `${packageManager} install` : `${packageManager} install`,
buildCommand:
packageManager === 'npm' ? `${packageManager} run build` : `${packageManager} build`,
startCommand:
Expand Down
1 change: 1 addition & 0 deletions src/lib/docker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export async function buildCacheImageWithNode(data, imageForBuild) {
const Dockerfile: Array<string> = [];
Dockerfile.push(`FROM ${imageForBuild}`);
Dockerfile.push('WORKDIR /usr/src/app');
Dockerfile.push(`LABEL coolify.image=true`);
if (secrets.length > 0) {
secrets.forEach((secret) => {
if (secret.isBuildSecret) {
Expand Down
3 changes: 3 additions & 0 deletions src/lib/haproxy/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,9 @@ export async function configureSimpleServiceProxyOn({ id, domain, port }) {
}

export async function configureSimpleServiceProxyOff(fqdn) {
if (!fqdn) {
return;
}
const domain = getDomain(fqdn);
const haproxy = await haproxyInstance();
await checkHAProxy(haproxy);
Expand Down
8 changes: 7 additions & 1 deletion src/lib/queues/builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,10 +239,16 @@ export default async function (job) {
baseDirectory,
publishDirectory
});
let envFound = false;
try {
envFound = !!(await fs.stat(`${workdir}/.env`));
} catch (error) {
//
}
try {
saveBuildLog({ line: 'Deployment started.', buildId, applicationId });
const { stderr } = await asyncExecShell(
`DOCKER_HOST=${host} docker run --env-file=${workdir}/.env ${labels.join(
`DOCKER_HOST=${host} docker run ${envFound && `--env-file=${workdir}/.env`} ${labels.join(
' '
)} --name ${imageId} --network ${
docker.network
Expand Down
14 changes: 7 additions & 7 deletions src/lib/queues/cleanup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,20 @@ export default async function () {
console.log(error);
}
if (!dev) {
//Cleanup images that are not managed by coolify
// Cleanup images that are not managed by coolify
try {
await asyncExecShell(
`DOCKER_HOST=${host} docker image prune --filter 'label!=coolify.image=true' -a -f`
);
} catch (error) {
console.log(error);
}
}
// Cleanup dangling images
try {
await asyncExecShell(`DOCKER_HOST=${host} docker image prune -f`);
} catch (error) {
console.log(error);
// Cleanup old images >3 days
try {
await asyncExecShell(`DOCKER_HOST=${host} docker image prune --filter "until=72h" -a -f`);
} catch (error) {
console.log(error);
}
}
}
}
6 changes: 3 additions & 3 deletions src/routes/applications/[id]/__layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
title="Stop application"
type="submit"
disabled={!$session.isAdmin}
class="icons bg-transparent tooltip-bottom text-sm flex items-center space-x-2 hover:bg-green-600 hover:text-white"
class="icons bg-transparent tooltip-bottom text-sm flex items-center space-x-2 text-red-500"
data-tooltip={$session.isAdmin
? 'Stop application'
: 'You do not have permission to stop the application.'}
Expand All @@ -153,7 +153,7 @@
title="Rebuild application"
type="submit"
disabled={!$session.isAdmin}
class="icons bg-transparent tooltip-bottom text-sm flex items-center space-x-2 hover:bg-green-600 hover:text-white"
class="icons bg-transparent tooltip-bottom text-sm flex items-center space-x-2 hover:text-green-500"
data-tooltip={$session.isAdmin
? 'Rebuild application'
: 'You do not have permission to rebuild application.'}
Expand Down Expand Up @@ -182,7 +182,7 @@
title="Build and start application"
type="submit"
disabled={!$session.isAdmin}
class="icons bg-transparent tooltip-bottom text-sm flex items-center space-x-2 hover:bg-green-600 hover:text-white"
class="icons bg-transparent tooltip-bottom text-sm flex items-center space-x-2 text-green-500"
data-tooltip={$session.isAdmin
? 'Build and start application'
: 'You do not have permission to Build and start application.'}
Expand Down
4 changes: 2 additions & 2 deletions src/routes/databases/[id]/__layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
title="Stop database"
type="submit"
disabled={!$session.isAdmin}
class="icons bg-transparent tooltip-bottom text-sm flex items-center space-x-2 hover:bg-purple-600 hover:text-white"
class="icons bg-transparent tooltip-bottom text-sm flex items-center space-x-2 text-red-500"
data-tooltip={$session.isAdmin
? 'Stop database'
: 'You do not have permission to stop the database.'}
Expand All @@ -146,7 +146,7 @@
title="Start database"
type="submit"
disabled={!$session.isAdmin}
class="icons bg-transparent tooltip-bottom text-sm flex items-center space-x-2 hover:bg-purple-600 hover:text-white"
class="icons bg-transparent tooltip-bottom text-sm flex items-center space-x-2 text-green-500"
data-tooltip={$session.isAdmin
? 'Start database'
: 'You do not have permission to start the database.'}
Expand Down
8 changes: 5 additions & 3 deletions src/routes/login/index.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,14 @@
class:text-stone-600={loading}
class:bg-coollabs={!loading}>{loading ? 'Authenticating...' : 'Login'}</button
>

<button
on:click|preventDefault={() => goto('/register')}
class="hover:opacity-90 text-white">Register</button
class="bg-transparent hover:bg-coolgray-300 text-white ">Register</button
>
<button class="bg-transparent" on:click|preventDefault={() => goto('/reset')}
>Reset password</button
<button
class="bg-transparent hover:bg-coolgray-300"
on:click|preventDefault={() => goto('/reset')}>Reset password</button
>
</div>
</form>
Expand Down
4 changes: 2 additions & 2 deletions src/routes/services/[id]/__layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@
title="Stop Service"
type="submit"
disabled={!$session.isAdmin}
class="icons bg-transparent tooltip-bottom text-sm flex items-center space-x-2 hover:bg-pink-600 hover:text-white"
class="icons bg-transparent tooltip-bottom text-sm flex items-center space-x-2 text-red-500"
data-tooltip={$session.isAdmin
? 'Stop Service'
: 'You do not have permission to stop the service.'}
Expand All @@ -166,7 +166,7 @@
title="Start Service"
type="submit"
disabled={!$session.isAdmin}
class="icons bg-transparent tooltip-bottom text-sm flex items-center space-x-2 hover:bg-pink-600 hover:text-white"
class="icons bg-transparent tooltip-bottom text-sm flex items-center space-x-2 text-green-500"
data-tooltip={$session.isAdmin
? 'Start Service'
: 'You do not have permission to start the service.'}
Expand Down

0 comments on commit b9da68e

Please sign in to comment.