-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Features: - Rust support 🦀 (Thanks to @pepoviola) - Add a default rewrite rule to PHP apps (to index.php) - Able to control upgrades in a straightforward way Fixes: - Improved upgrade scripts - Simplified prechecks before deployment - Fixed path deployments - Fixed already defined apps redirections - Better error handling - still needs a lot of improvement here!
- Loading branch information
1 parent
166a573
commit bad8428
Showing
56 changed files
with
895 additions
and
657 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
node_modules | ||
dist | ||
.routify | ||
.routify | ||
.pnpm-store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,5 @@ dist-ssr | |
yarn-error.log | ||
api/development/console.log | ||
.pnpm-debug.log | ||
yarn.lock | ||
yarn.lock | ||
.pnpm-store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
const fs = require('fs').promises | ||
const { streamEvents, docker } = require('../../libs/docker') | ||
|
||
module.exports = async function (configuration) { | ||
try { | ||
const path = `${configuration.general.workdir}/${configuration.build.directory ? configuration.build.directory : ''}` | ||
if (fs.stat(`${path}/Dockerfile`)) { | ||
const stream = await docker.engine.buildImage( | ||
{ src: ['.'], context: path }, | ||
{ t: `${configuration.build.container.name}:${configuration.build.container.tag}` } | ||
) | ||
await streamEvents(stream, configuration) | ||
} else { | ||
throw { error: 'No custom dockerfile found.', type: 'app' } | ||
} | ||
} catch (error) { | ||
throw { error, type: 'server' } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
const fs = require('fs').promises | ||
const { streamEvents, docker } = require('../../libs/docker') | ||
// 'HEALTHCHECK --timeout=10s --start-period=10s --interval=5s CMD curl -I -s -f http://localhost/ || exit 1', | ||
const publishPHPDocker = (configuration) => { | ||
return [ | ||
'FROM php:apache', | ||
'RUN a2enmod rewrite', | ||
'WORKDIR /usr/src/app', | ||
`COPY .${configuration.build.directory} /var/www/html`, | ||
'EXPOSE 80', | ||
' CMD ["apache2-foreground"]' | ||
].join('\n') | ||
} | ||
|
||
module.exports = async function (configuration) { | ||
try { | ||
await fs.writeFile(`${configuration.general.workdir}/Dockerfile`, publishPHPDocker(configuration)) | ||
const stream = await docker.engine.buildImage( | ||
{ src: ['.'], context: configuration.general.workdir }, | ||
{ t: `${configuration.build.container.name}:${configuration.build.container.tag}` } | ||
) | ||
await streamEvents(stream, configuration) | ||
} catch (error) { | ||
throw { error, type: 'server' } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
const fs = require('fs').promises | ||
const { streamEvents, docker } = require('../../libs/docker') | ||
const { execShellAsync } = require('../../libs/common') | ||
const TOML = require('@iarna/toml') | ||
|
||
const publishRustDocker = (configuration, custom) => { | ||
return [ | ||
'FROM rust:latest', | ||
'WORKDIR /app', | ||
`COPY --from=${configuration.build.container.name}:cache /app/target target`, | ||
`COPY --from=${configuration.build.container.name}:cache /usr/local/cargo /usr/local/cargo`, | ||
'COPY . .', | ||
`RUN cargo build --release --bin ${custom.name}`, | ||
'FROM debian:buster-slim', | ||
'WORKDIR /app', | ||
'RUN apt-get update -y && apt-get install -y --no-install-recommends openssl libcurl4 ca-certificates && apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/*', | ||
'RUN update-ca-certificates', | ||
`COPY --from=${configuration.build.container.name}:cache /app/target/release/${custom.name} ${custom.name}`, | ||
`EXPOSE ${configuration.publish.port}`, | ||
`CMD ["/app/${custom.name}"]` | ||
].join('\n') | ||
} | ||
|
||
const cacheRustDocker = (configuration, custom) => { | ||
return [ | ||
`FROM rust:latest AS planner-${configuration.build.container.name}`, | ||
'WORKDIR /app', | ||
'RUN cargo install cargo-chef', | ||
'COPY . .', | ||
'RUN cargo chef prepare --recipe-path recipe.json', | ||
'FROM rust:latest', | ||
'WORKDIR /app', | ||
'RUN cargo install cargo-chef', | ||
`COPY --from=planner-${configuration.build.container.name} /app/recipe.json recipe.json`, | ||
'RUN cargo chef cook --release --recipe-path recipe.json' | ||
].join('\n') | ||
} | ||
|
||
module.exports = async function (configuration) { | ||
try { | ||
const cargoToml = await execShellAsync(`cat ${configuration.general.workdir}/Cargo.toml`) | ||
const parsedToml = TOML.parse(cargoToml) | ||
const custom = { | ||
name: parsedToml.package.name | ||
} | ||
await fs.writeFile(`${configuration.general.workdir}/Dockerfile`, cacheRustDocker(configuration, custom)) | ||
|
||
let stream = await docker.engine.buildImage( | ||
{ src: ['.'], context: configuration.general.workdir }, | ||
{ t: `${configuration.build.container.name}:cache` } | ||
) | ||
await streamEvents(stream, configuration) | ||
|
||
await fs.writeFile(`${configuration.general.workdir}/Dockerfile`, publishRustDocker(configuration, custom)) | ||
|
||
stream = await docker.engine.buildImage( | ||
{ src: ['.'], context: configuration.general.workdir }, | ||
{ t: `${configuration.build.container.name}:${configuration.build.container.tag}` } | ||
) | ||
await streamEvents(stream, configuration) | ||
} catch (error) { | ||
throw { error, type: 'server' } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.