diff --git a/.devcontainer/cevi/devcontainer.json b/.devcontainer/cevi/devcontainer.json new file mode 100644 index 0000000..b9a18d2 --- /dev/null +++ b/.devcontainer/cevi/devcontainer.json @@ -0,0 +1,40 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: +// https://github.com/microsoft/vscode-dev-containers/tree/v0.245.2/containers/docker-existing-docker-compose +// If you want to run as a non-root user in the container, see .devcontainer/docker-compose.yml. +{ + "name": "Hitobito CEVI", + + "dockerComposeFile": [ + "../../docker-compose.yml", + "../docker-compose.yml" + ], + + // The 'service' property is the name of the service for the container that VS Code should + // use. Update this value and .devcontainer/docker-compose.yml to the real service name. + "service": "rails", + + "workspaceFolder": "/usr/src/app", + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + "forwardPorts": [ + 3000, + 1080, + 3306 + ], + + "initializeCommand": ".devcontainer/initialize.sh https://github.com/hitobito/hitobito.git https://github.com/hitobito/hitobito_youth.git https://github.com/hitobito/hitobito_cevi.git", + + "onCreateCommand": "/workspace/.devcontainer/create.sh", + + "updateContentCommand": "/workspace/.devcontainer/update.sh", + + "customizations": { + "vscode": { + "extensions": [ + "KoichiSasada.vscode-rdbg", + "Shopify.ruby-lsp", + "sorbet.sorbet-vscode-extension" + ] + } + } +} diff --git a/.devcontainer/create.sh b/.devcontainer/create.sh new file mode 100755 index 0000000..211d523 --- /dev/null +++ b/.devcontainer/create.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +# This script will be run _inside_ the container everytime you create a devontainer. This happens after the initialize.sh script. + +sudo gem install debug + +/usr/local/bin/rails-entrypoint.sh echo "Finished initializing!" diff --git a/.devcontainer/die_mitte/devcontainer.json b/.devcontainer/die_mitte/devcontainer.json new file mode 100644 index 0000000..36f5fe2 --- /dev/null +++ b/.devcontainer/die_mitte/devcontainer.json @@ -0,0 +1,40 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: +// https://github.com/microsoft/vscode-dev-containers/tree/v0.245.2/containers/docker-existing-docker-compose +// If you want to run as a non-root user in the container, see .devcontainer/docker-compose.yml. +{ + "name": "Hitobito Die Mitte", + + "dockerComposeFile": [ + "../../docker-compose.yml", + "../docker-compose.yml" + ], + + // The 'service' property is the name of the service for the container that VS Code should + // use. Update this value and .devcontainer/docker-compose.yml to the real service name. + "service": "rails", + + "workspaceFolder": "/usr/src/app", + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + "forwardPorts": [ + 3000, + 1080, + 3306 + ], + + "initializeCommand": ".devcontainer/initialize.sh https://github.com/hitobito/hitobito.git https://github.com/hitobito/hitobito_die_mitte.git", + + "onCreateCommand": "/workspace/.devcontainer/create.sh", + + "updateContentCommand": "/workspace/.devcontainer/update.sh", + + "customizations": { + "vscode": { + "extensions": [ + "KoichiSasada.vscode-rdbg", + "Shopify.ruby-lsp", + "sorbet.sorbet-vscode-extension" + ] + } + } +} diff --git a/.devcontainer/digisus_lab/devcontainer.json b/.devcontainer/digisus_lab/devcontainer.json new file mode 100644 index 0000000..2cc3de7 --- /dev/null +++ b/.devcontainer/digisus_lab/devcontainer.json @@ -0,0 +1,40 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: +// https://github.com/microsoft/vscode-dev-containers/tree/v0.245.2/containers/docker-existing-docker-compose +// If you want to run as a non-root user in the container, see .devcontainer/docker-compose.yml. +{ + "name": "Hitobito Digisus Lab", + + "dockerComposeFile": [ + "../../docker-compose.yml", + "../docker-compose.yml" + ], + + // The 'service' property is the name of the service for the container that VS Code should + // use. Update this value and .devcontainer/docker-compose.yml to the real service name. + "service": "rails", + + "workspaceFolder": "/usr/src/app", + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + "forwardPorts": [ + 3000, + 1080, + 3306 + ], + + "initializeCommand": ".devcontainer/initialize.sh https://github.com/hitobito/hitobito.git https://github.com/hitobito/hitobito_digisus_lab.git", + + "onCreateCommand": "/workspace/.devcontainer/create.sh", + + "updateContentCommand": "/workspace/.devcontainer/update.sh", + + "customizations": { + "vscode": { + "extensions": [ + "KoichiSasada.vscode-rdbg", + "Shopify.ruby-lsp", + "sorbet.sorbet-vscode-extension" + ] + } + } +} diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml new file mode 100644 index 0000000..de3e39c --- /dev/null +++ b/.devcontainer/docker-compose.yml @@ -0,0 +1,31 @@ +version: '3.4' +services: + rails: + volumes: + - .:/workspace:cached + + # Skip entrypoint which would try to migrate on entry + entrypoint: [] + # Overrides default command so things don't shut down after the process ends. + command: sleep infinity + # disable healthcheck, we override the command which would not respond! + healthcheck: {} + # Allow accessing docker + privileged: true + # redefine dependencies, not waiting for the rails container to be healthy. it will never be, since it's missing the healthcheck… + worker: + depends_on: + rails: + condition: service_started + db: + condition: service_healthy + mailcatcher: + condition: service_healthy + cache: + condition: service_started + sphinx: + depends_on: + db: + condition: service_healthy + rails: + condition: service_started \ No newline at end of file diff --git a/.devcontainer/dsj/devcontainer.json b/.devcontainer/dsj/devcontainer.json new file mode 100644 index 0000000..665a05b --- /dev/null +++ b/.devcontainer/dsj/devcontainer.json @@ -0,0 +1,40 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: +// https://github.com/microsoft/vscode-dev-containers/tree/v0.245.2/containers/docker-existing-docker-compose +// If you want to run as a non-root user in the container, see .devcontainer/docker-compose.yml. +{ + "name": "Hitobito DSJ", + + "dockerComposeFile": [ + "../../docker-compose.yml", + "../docker-compose.yml" + ], + + // The 'service' property is the name of the service for the container that VS Code should + // use. Update this value and .devcontainer/docker-compose.yml to the real service name. + "service": "rails", + + "workspaceFolder": "/usr/src/app", + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + "forwardPorts": [ + 3000, + 1080, + 3306 + ], + + "initializeCommand": ".devcontainer/initialize.sh https://github.com/hitobito/hitobito.git https://github.com/hitobito/hitobito_dsj.git", + + "onCreateCommand": "/workspace/.devcontainer/create.sh", + + "updateContentCommand": "/workspace/.devcontainer/update.sh", + + "customizations": { + "vscode": { + "extensions": [ + "KoichiSasada.vscode-rdbg", + "Shopify.ruby-lsp", + "sorbet.sorbet-vscode-extension" + ] + } + } +} diff --git a/.devcontainer/generic/devcontainer.json b/.devcontainer/generic/devcontainer.json new file mode 100644 index 0000000..4b03e89 --- /dev/null +++ b/.devcontainer/generic/devcontainer.json @@ -0,0 +1,40 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: +// https://github.com/microsoft/vscode-dev-containers/tree/v0.245.2/containers/docker-existing-docker-compose +// If you want to run as a non-root user in the container, see .devcontainer/docker-compose.yml. +{ + "name": "Hitobito Generic", + + "dockerComposeFile": [ + "../../docker-compose.yml", + "../docker-compose.yml" + ], + + // The 'service' property is the name of the service for the container that VS Code should + // use. Update this value and .devcontainer/docker-compose.yml to the real service name. + "service": "rails", + + "workspaceFolder": "/usr/src/app", + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + "forwardPorts": [ + 3000, + 1080, + 3306 + ], + + "initializeCommand": ".devcontainer/initialize.sh https://github.com/hitobito/hitobito.git https://github.com/hitobito/hitobito_generic.git", + + "onCreateCommand": "/workspace/.devcontainer/create.sh", + + "updateContentCommand": "/workspace/.devcontainer/update.sh", + + "customizations": { + "vscode": { + "extensions": [ + "KoichiSasada.vscode-rdbg", + "Shopify.ruby-lsp", + "sorbet.sorbet-vscode-extension" + ] + } + } +} diff --git a/.devcontainer/glp/devcontainer.json b/.devcontainer/glp/devcontainer.json new file mode 100644 index 0000000..f3c013d --- /dev/null +++ b/.devcontainer/glp/devcontainer.json @@ -0,0 +1,40 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: +// https://github.com/microsoft/vscode-dev-containers/tree/v0.245.2/containers/docker-existing-docker-compose +// If you want to run as a non-root user in the container, see .devcontainer/docker-compose.yml. +{ + "name": "Hitobito GLP", + + "dockerComposeFile": [ + "../../docker-compose.yml", + "../docker-compose.yml" + ], + + // The 'service' property is the name of the service for the container that VS Code should + // use. Update this value and .devcontainer/docker-compose.yml to the real service name. + "service": "rails", + + "workspaceFolder": "/usr/src/app", + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + "forwardPorts": [ + 3000, + 1080, + 3306 + ], + + "initializeCommand": ".devcontainer/initialize.sh https://github.com/hitobito/hitobito.git https://github.com/hitobito/hitobito_glp.git", + + "onCreateCommand": "/workspace/.devcontainer/create.sh", + + "updateContentCommand": "/workspace/.devcontainer/update.sh", + + "customizations": { + "vscode": { + "extensions": [ + "KoichiSasada.vscode-rdbg", + "Shopify.ruby-lsp", + "sorbet.sorbet-vscode-extension" + ] + } + } +} diff --git a/.devcontainer/initialize.sh b/.devcontainer/initialize.sh new file mode 100755 index 0000000..a6e132e --- /dev/null +++ b/.devcontainer/initialize.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +# This script will be run _outside_ the container everytime you create a devcontainer (locally or in the cloud) + +docker volume create hitobito_bundle +docker volume create hitobito_yarn_cache + +# Check if an argument was provided +if [ $# -eq 0 ] +then + echo "Usage: $0 url1 url2 url3 ..." + exit 1 +fi + +if [ -d "app/hitobito" ]; then + echo "Already cloned, skipping…" + exit 0 +fi + +# Create the app directory if it doesn't exist +mkdir -p app + +# Loop over the URLs and clone each repository into the app directory +for url in "$@" +do + echo "Cloning $url into app/$(basename $url .git)" + git clone "$url" "app/$(basename $url .git)" +done diff --git a/.devcontainer/insieme/devcontainer.json b/.devcontainer/insieme/devcontainer.json new file mode 100644 index 0000000..a004996 --- /dev/null +++ b/.devcontainer/insieme/devcontainer.json @@ -0,0 +1,40 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: +// https://github.com/microsoft/vscode-dev-containers/tree/v0.245.2/containers/docker-existing-docker-compose +// If you want to run as a non-root user in the container, see .devcontainer/docker-compose.yml. +{ + "name": "Hitobito Insieme", + + "dockerComposeFile": [ + "../../docker-compose.yml", + "../docker-compose.yml" + ], + + // The 'service' property is the name of the service for the container that VS Code should + // use. Update this value and .devcontainer/docker-compose.yml to the real service name. + "service": "rails", + + "workspaceFolder": "/usr/src/app", + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + "forwardPorts": [ + 3000, + 1080, + 3306 + ], + + "initializeCommand": ".devcontainer/initialize.sh https://github.com/hitobito/hitobito.git https://github.com/hitobito/hitobito_insieme.git", + + "onCreateCommand": "/workspace/.devcontainer/create.sh", + + "updateContentCommand": "/workspace/.devcontainer/update.sh", + + "customizations": { + "vscode": { + "extensions": [ + "KoichiSasada.vscode-rdbg", + "Shopify.ruby-lsp", + "sorbet.sorbet-vscode-extension" + ] + } + } +} diff --git a/.devcontainer/jubla/devcontainer.json b/.devcontainer/jubla/devcontainer.json new file mode 100644 index 0000000..80a7055 --- /dev/null +++ b/.devcontainer/jubla/devcontainer.json @@ -0,0 +1,40 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: +// https://github.com/microsoft/vscode-dev-containers/tree/v0.245.2/containers/docker-existing-docker-compose +// If you want to run as a non-root user in the container, see .devcontainer/docker-compose.yml. +{ + "name": "Hitobito Jubla", + + "dockerComposeFile": [ + "../../docker-compose.yml", + "../docker-compose.yml" + ], + + // The 'service' property is the name of the service for the container that VS Code should + // use. Update this value and .devcontainer/docker-compose.yml to the real service name. + "service": "rails", + + "workspaceFolder": "/usr/src/app", + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + "forwardPorts": [ + 3000, + 1080, + 3306 + ], + + "initializeCommand": ".devcontainer/initialize.sh https://github.com/hitobito/hitobito.git https://github.com/hitobito/hitobito_youth.git https://github.com/hitobito/hitobito_jubla.git", + + "onCreateCommand": "/workspace/.devcontainer/create.sh", + + "updateContentCommand": "/workspace/.devcontainer/update.sh", + + "customizations": { + "vscode": { + "extensions": [ + "KoichiSasada.vscode-rdbg", + "Shopify.ruby-lsp", + "sorbet.sorbet-vscode-extension" + ] + } + } +} diff --git a/.devcontainer/kljb/devcontainer.json b/.devcontainer/kljb/devcontainer.json new file mode 100644 index 0000000..2a5c213 --- /dev/null +++ b/.devcontainer/kljb/devcontainer.json @@ -0,0 +1,40 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: +// https://github.com/microsoft/vscode-dev-containers/tree/v0.245.2/containers/docker-existing-docker-compose +// If you want to run as a non-root user in the container, see .devcontainer/docker-compose.yml. +{ + "name": "Hitobito KLJB", + + "dockerComposeFile": [ + "../../docker-compose.yml", + "../docker-compose.yml" + ], + + // The 'service' property is the name of the service for the container that VS Code should + // use. Update this value and .devcontainer/docker-compose.yml to the real service name. + "service": "rails", + + "workspaceFolder": "/usr/src/app", + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + "forwardPorts": [ + 3000, + 1080, + 3306 + ], + + "initializeCommand": ".devcontainer/initialize.sh https://github.com/hitobito/hitobito.git https://github.com/hitobito/hitobito_youth.git https://github.com/hitobito/hitobito_kljb.git", + + "onCreateCommand": "/workspace/.devcontainer/create.sh", + + "updateContentCommand": "/workspace/.devcontainer/update.sh", + + "customizations": { + "vscode": { + "extensions": [ + "KoichiSasada.vscode-rdbg", + "Shopify.ruby-lsp", + "sorbet.sorbet-vscode-extension" + ] + } + } +} diff --git a/.devcontainer/pbs/devcontainer.json b/.devcontainer/pbs/devcontainer.json new file mode 100644 index 0000000..4ce34ca --- /dev/null +++ b/.devcontainer/pbs/devcontainer.json @@ -0,0 +1,40 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: +// https://github.com/microsoft/vscode-dev-containers/tree/v0.245.2/containers/docker-existing-docker-compose +// If you want to run as a non-root user in the container, see .devcontainer/docker-compose.yml. +{ + "name": "Hitobito PBS", + + "dockerComposeFile": [ + "../../docker-compose.yml", + "../docker-compose.yml" + ], + + // The 'service' property is the name of the service for the container that VS Code should + // use. Update this value and .devcontainer/docker-compose.yml to the real service name. + "service": "rails", + + "workspaceFolder": "/usr/src/app", + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + "forwardPorts": [ + 3000, + 1080, + 3306 + ], + + "initializeCommand": ".devcontainer/initialize.sh https://github.com/hitobito/hitobito.git https://github.com/hitobito/hitobito_youth.git https://github.com/hitobito/hitobito_pbs.git", + + "onCreateCommand": "/workspace/.devcontainer/create.sh", + + "updateContentCommand": "/workspace/.devcontainer/update.sh", + + "customizations": { + "vscode": { + "extensions": [ + "KoichiSasada.vscode-rdbg", + "Shopify.ruby-lsp", + "sorbet.sorbet-vscode-extension" + ] + } + } +} diff --git a/.devcontainer/pro_natura/devcontainer.json b/.devcontainer/pro_natura/devcontainer.json new file mode 100644 index 0000000..83bede6 --- /dev/null +++ b/.devcontainer/pro_natura/devcontainer.json @@ -0,0 +1,40 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: +// https://github.com/microsoft/vscode-dev-containers/tree/v0.245.2/containers/docker-existing-docker-compose +// If you want to run as a non-root user in the container, see .devcontainer/docker-compose.yml. +{ + "name": "Hitobito Pro Natura", + + "dockerComposeFile": [ + "../../docker-compose.yml", + "../docker-compose.yml" + ], + + // The 'service' property is the name of the service for the container that VS Code should + // use. Update this value and .devcontainer/docker-compose.yml to the real service name. + "service": "rails", + + "workspaceFolder": "/usr/src/app", + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + "forwardPorts": [ + 3000, + 1080, + 3306 + ], + + "initializeCommand": ".devcontainer/initialize.sh https://github.com/hitobito/hitobito.git https://github.com/hitobito/hitobito_youth.git https://github.com/hitobito/hitobito_pro_natura.git", + + "onCreateCommand": "/workspace/.devcontainer/create.sh", + + "updateContentCommand": "/workspace/.devcontainer/update.sh", + + "customizations": { + "vscode": { + "extensions": [ + "KoichiSasada.vscode-rdbg", + "Shopify.ruby-lsp", + "sorbet.sorbet-vscode-extension" + ] + } + } +} diff --git a/.devcontainer/sbv/devcontainer.json b/.devcontainer/sbv/devcontainer.json new file mode 100644 index 0000000..1123ba1 --- /dev/null +++ b/.devcontainer/sbv/devcontainer.json @@ -0,0 +1,40 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: +// https://github.com/microsoft/vscode-dev-containers/tree/v0.245.2/containers/docker-existing-docker-compose +// If you want to run as a non-root user in the container, see .devcontainer/docker-compose.yml. +{ + "name": "Hitobito SBV", + + "dockerComposeFile": [ + "../../docker-compose.yml", + "../docker-compose.yml" + ], + + // The 'service' property is the name of the service for the container that VS Code should + // use. Update this value and .devcontainer/docker-compose.yml to the real service name. + "service": "rails", + + "workspaceFolder": "/usr/src/app", + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + "forwardPorts": [ + 3000, + 1080, + 3306 + ], + + "initializeCommand": ".devcontainer/initialize.sh https://github.com/hitobito/hitobito.git https://github.com/hitobito/hitobito_sbv.git", + + "onCreateCommand": "/workspace/.devcontainer/create.sh", + + "updateContentCommand": "/workspace/.devcontainer/update.sh", + + "customizations": { + "vscode": { + "extensions": [ + "KoichiSasada.vscode-rdbg", + "Shopify.ruby-lsp", + "sorbet.sorbet-vscode-extension" + ] + } + } +} diff --git a/.devcontainer/sjas/devcontainer.json b/.devcontainer/sjas/devcontainer.json new file mode 100644 index 0000000..0c40b7c --- /dev/null +++ b/.devcontainer/sjas/devcontainer.json @@ -0,0 +1,40 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: +// https://github.com/microsoft/vscode-dev-containers/tree/v0.245.2/containers/docker-existing-docker-compose +// If you want to run as a non-root user in the container, see .devcontainer/docker-compose.yml. +{ + "name": "Hitobito SJAS", + + "dockerComposeFile": [ + "../../docker-compose.yml", + "../docker-compose.yml" + ], + + // The 'service' property is the name of the service for the container that VS Code should + // use. Update this value and .devcontainer/docker-compose.yml to the real service name. + "service": "rails", + + "workspaceFolder": "/usr/src/app", + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + "forwardPorts": [ + 3000, + 1080, + 3306 + ], + + "initializeCommand": ".devcontainer/initialize.sh https://github.com/hitobito/hitobito.git https://github.com/hitobito/hitobito_youth.git https://github.com/hitobito/hitobito_sjas.git", + + "onCreateCommand": "/workspace/.devcontainer/create.sh", + + "updateContentCommand": "/workspace/.devcontainer/update.sh", + + "customizations": { + "vscode": { + "extensions": [ + "KoichiSasada.vscode-rdbg", + "Shopify.ruby-lsp", + "sorbet.sorbet-vscode-extension" + ] + } + } +} diff --git a/.devcontainer/skv/devcontainer.json b/.devcontainer/skv/devcontainer.json new file mode 100644 index 0000000..4cb403e --- /dev/null +++ b/.devcontainer/skv/devcontainer.json @@ -0,0 +1,40 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: +// https://github.com/microsoft/vscode-dev-containers/tree/v0.245.2/containers/docker-existing-docker-compose +// If you want to run as a non-root user in the container, see .devcontainer/docker-compose.yml. +{ + "name": "Hitobito SKV", + + "dockerComposeFile": [ + "../../docker-compose.yml", + "../docker-compose.yml" + ], + + // The 'service' property is the name of the service for the container that VS Code should + // use. Update this value and .devcontainer/docker-compose.yml to the real service name. + "service": "rails", + + "workspaceFolder": "/usr/src/app", + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + "forwardPorts": [ + 3000, + 1080, + 3306 + ], + + "initializeCommand": ".devcontainer/initialize.sh https://github.com/hitobito/hitobito.git https://github.com/hitobito/hitobito_skv.git", + + "onCreateCommand": "/workspace/.devcontainer/create.sh", + + "updateContentCommand": "/workspace/.devcontainer/update.sh", + + "customizations": { + "vscode": { + "extensions": [ + "KoichiSasada.vscode-rdbg", + "Shopify.ruby-lsp", + "sorbet.sorbet-vscode-extension" + ] + } + } +} diff --git a/.devcontainer/svse/devcontainer.json b/.devcontainer/svse/devcontainer.json new file mode 100644 index 0000000..72f4f2a --- /dev/null +++ b/.devcontainer/svse/devcontainer.json @@ -0,0 +1,40 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: +// https://github.com/microsoft/vscode-dev-containers/tree/v0.245.2/containers/docker-existing-docker-compose +// If you want to run as a non-root user in the container, see .devcontainer/docker-compose.yml. +{ + "name": "Hitobito SVSE", + + "dockerComposeFile": [ + "../../docker-compose.yml", + "../docker-compose.yml" + ], + + // The 'service' property is the name of the service for the container that VS Code should + // use. Update this value and .devcontainer/docker-compose.yml to the real service name. + "service": "rails", + + "workspaceFolder": "/usr/src/app", + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + "forwardPorts": [ + 3000, + 1080, + 3306 + ], + + "initializeCommand": ".devcontainer/initialize.sh https://github.com/hitobito/hitobito.git https://github.com/hitobito/hitobito_svse.git", + + "onCreateCommand": "/workspace/.devcontainer/create.sh", + + "updateContentCommand": "/workspace/.devcontainer/update.sh", + + "customizations": { + "vscode": { + "extensions": [ + "KoichiSasada.vscode-rdbg", + "Shopify.ruby-lsp", + "sorbet.sorbet-vscode-extension" + ] + } + } +} diff --git a/.devcontainer/sww/devcontainer.json b/.devcontainer/sww/devcontainer.json new file mode 100644 index 0000000..220e1af --- /dev/null +++ b/.devcontainer/sww/devcontainer.json @@ -0,0 +1,40 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: +// https://github.com/microsoft/vscode-dev-containers/tree/v0.245.2/containers/docker-existing-docker-compose +// If you want to run as a non-root user in the container, see .devcontainer/docker-compose.yml. +{ + "name": "Hitobito SWW", + + "dockerComposeFile": [ + "../../docker-compose.yml", + "../docker-compose.yml" + ], + + // The 'service' property is the name of the service for the container that VS Code should + // use. Update this value and .devcontainer/docker-compose.yml to the real service name. + "service": "rails", + + "workspaceFolder": "/usr/src/app", + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + "forwardPorts": [ + 3000, + 1080, + 3306 + ], + + "initializeCommand": ".devcontainer/initialize.sh https://github.com/hitobito/hitobito.git https://github.com/hitobito/hitobito_sww.git", + + "onCreateCommand": "/workspace/.devcontainer/create.sh", + + "updateContentCommand": "/workspace/.devcontainer/update.sh", + + "customizations": { + "vscode": { + "extensions": [ + "KoichiSasada.vscode-rdbg", + "Shopify.ruby-lsp", + "sorbet.sorbet-vscode-extension" + ] + } + } +} diff --git a/.devcontainer/tenant/devcontainer.json b/.devcontainer/tenant/devcontainer.json new file mode 100644 index 0000000..6d93fa6 --- /dev/null +++ b/.devcontainer/tenant/devcontainer.json @@ -0,0 +1,40 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: +// https://github.com/microsoft/vscode-dev-containers/tree/v0.245.2/containers/docker-existing-docker-compose +// If you want to run as a non-root user in the container, see .devcontainer/docker-compose.yml. +{ + "name": "Hitobito Tenant", + + "dockerComposeFile": [ + "../../docker-compose.yml", + "../docker-compose.yml" + ], + + // The 'service' property is the name of the service for the container that VS Code should + // use. Update this value and .devcontainer/docker-compose.yml to the real service name. + "service": "rails", + + "workspaceFolder": "/usr/src/app", + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + "forwardPorts": [ + 3000, + 1080, + 3306 + ], + + "initializeCommand": ".devcontainer/initialize.sh https://github.com/hitobito/hitobito.git https://github.com/hitobito/hitobito_generic.git https://github.com/hitobito/hitobito_tenant.git", + + "onCreateCommand": "/workspace/.devcontainer/create.sh", + + "updateContentCommand": "/workspace/.devcontainer/update.sh", + + "customizations": { + "vscode": { + "extensions": [ + "KoichiSasada.vscode-rdbg", + "Shopify.ruby-lsp", + "sorbet.sorbet-vscode-extension" + ] + } + } +} diff --git a/.devcontainer/tpunkt/devcontainer.json b/.devcontainer/tpunkt/devcontainer.json new file mode 100644 index 0000000..7faf86e --- /dev/null +++ b/.devcontainer/tpunkt/devcontainer.json @@ -0,0 +1,40 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: +// https://github.com/microsoft/vscode-dev-containers/tree/v0.245.2/containers/docker-existing-docker-compose +// If you want to run as a non-root user in the container, see .devcontainer/docker-compose.yml. +{ + "name": "Hitobito Tpunkt", + + "dockerComposeFile": [ + "../../docker-compose.yml", + "../docker-compose.yml" + ], + + // The 'service' property is the name of the service for the container that VS Code should + // use. Update this value and .devcontainer/docker-compose.yml to the real service name. + "service": "rails", + + "workspaceFolder": "/usr/src/app", + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + "forwardPorts": [ + 3000, + 1080, + 3306 + ], + + "initializeCommand": ".devcontainer/initialize.sh https://github.com/hitobito/hitobito.git https://github.com/hitobito/hitobito_tpunkt.git", + + "onCreateCommand": "/workspace/.devcontainer/create.sh", + + "updateContentCommand": "/workspace/.devcontainer/update.sh", + + "customizations": { + "vscode": { + "extensions": [ + "KoichiSasada.vscode-rdbg", + "Shopify.ruby-lsp", + "sorbet.sorbet-vscode-extension" + ] + } + } +} diff --git a/.devcontainer/update.sh b/.devcontainer/update.sh new file mode 100755 index 0000000..a15cee0 --- /dev/null +++ b/.devcontainer/update.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +# This scipt will be run _inside_ the container everytime you create a devontainer (or on a schedule in the cloud). This happens after the initialize.sh and after the create.sh script. + +# Set the directory containing git repositories +repositories_dir=. + +# Loop over the directories in the repositories directory +for repository_dir in "$repositories_dir"/*/ +do + # Check if the directory is a git repository + if [ -d "$repository_dir/.git" ] + then + # Change into the repository directory, discard all local changes, and pull the latest changes + cd "$repository_dir" + echo "Updating repository: $(basename $repository_dir)" + git checkout Gemfile.lock + git pull --ff-only + fi +done + +SKIP_SEEDS=1 SKIP_WAGONFILE=1 /usr/local/bin/rails-entrypoint.sh echo "All up to date!" diff --git a/.gitignore b/.gitignore index c60eb1c..9871738 100644 --- a/.gitignore +++ b/.gitignore @@ -3,7 +3,10 @@ .local .yarnrc /dumps -docker/home/rails/.gem/ -docker/home/rails/.irb_history -docker/home/rails/.viminfo +docker/home/rails/ +!docker/home/rails/.pryrc +!docker/home/rails/.bashrc +!docker/home/rails/.gitignore /shared/.env.generated +app/* +!app/.vscode diff --git a/README.md b/README.md index 5c5f8c2..4130007 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,11 @@ We're glad you want to setup your machine for hitobito development 💃 +> [!IMPORTANT] +> For an easy to use quick start solution you can use [devcontainers and codespaces][devcontainers]. + +[devcontainers]: doc/Devcontainer.md + ## System Requirements You need to have [Docker][docker] and _[docker-compose][doco]_ installed on your computer. diff --git a/app/.gitignore b/app/.gitignore deleted file mode 100644 index 72e8ffc..0000000 --- a/app/.gitignore +++ /dev/null @@ -1 +0,0 @@ -* diff --git a/app/.vscode/launch.json b/app/.vscode/launch.json new file mode 100644 index 0000000..5462edb --- /dev/null +++ b/app/.vscode/launch.json @@ -0,0 +1,26 @@ +{ + // Verwendet IntelliSense zum Ermitteln möglicher Attribute. + // Zeigen Sie auf vorhandene Attribute, um die zugehörigen Beschreibungen anzuzeigen. + // Weitere Informationen finden Sie unter https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "rdbg", + "name": "Debug Server", + "request": "launch", + "script": "bin/rails", + "args": ["server", "-b", "0.0.0.0"], + "useBundler": true, + "cwd": "${workspaceFolder}/hitobito" + }, + { + "type": "rdbg", + "name": "Debug Tests", + "request": "launch", + "script": "bin/rspec", + "useBundler": true, + "askParameters": true, + "cwd": "${workspaceFolder}/hitobito" + } + ] +} \ No newline at end of file diff --git a/doc/Devcontainer.md b/doc/Devcontainer.md new file mode 100644 index 0000000..b2b8ea7 --- /dev/null +++ b/doc/Devcontainer.md @@ -0,0 +1,84 @@ +# Devcontainers & GitHub Codespaces + +This repository has devcontainers available. They are a standard way to run development completely isolated. You find more information about them on https://containers.dev. Essentially, it runs your favorite IDE inside a Docker Container. +This documentation focuses on getting up and running and will not get into details about how devcontainers work. + +Devcontainers can be run locally or in the cloud with GitHub Codespaces. Each have their advantages and drawbacks. +**Codespaces** are generally instant to start and immediately ready to run. However you need a (somewhat) stable internet connection to work and they might cost something (for hobby use, the free usage will probably be enough: https://github.com/features/codespaces#pricing). To learn more about codespaces, see [here](https://docs.github.com/en/codespaces). GitHubs documentation is quite thorough. +**Locally** running the devcontainers has the advantage that it's always free and doesn't need an internet connection to work but they need some time to pull all the docker images and ruby gems and to seed the database with initial test data. + +## Local Setup + +> [!NOTE] +> devcontainers can be used with many IDEs. This guide only presents VS Code, as it's Free. See https://containers.dev/supporting for more. + +To get started with locally running the devcontainers, you need the following: +- [docker](https://docs.docker.com/get-docker/) and the [docker compose plugin](https://docs.docker.com/compose/install/) +- [Visual studio code](https://code.visualstudio.com) +- The [dev container extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) + +_You'll find more detailed requirements [here](https://code.visualstudio.com/docs/devcontainers/containers#_getting-started)._ + +1. To start testing, open this repository in VS Code and click on the green remote development button in the lower left corner of the window: +![](remote-dev-button.png) +2. In the menu that pops up, select "Reopen in Container" +3. Select the variant (wagon) you want to run. +4. Grab a coffee! The dev container will start which takes quite some time (depending on your computer this might take over 15min). It will clone the wagons, install all the ruby gems and migrate as well as seed the database. + +## GitHub Codespaces Setup + +In general, see here: https://docs.github.com/en/codespaces/developing-in-codespaces/creating-a-codespace-for-a-repository#creating-a-codespace-for-a-repository + +Some notes for starting a hitobito codespace: + +- Make sure to select "New with options" and then select the desired configuration. Otherwise it launches without any setup and won't be able to run. +- No need to change the branch, as it only changes the branch of the development environment, but not hitobito itself. + +If you want to get familiar with codespaces, check the quickstart guide here: https://docs.github.com/en/codespaces/getting-started/quickstart + +> [!WARNING] +> If you run codespaces in the browser, you will have issues with CORS. Either run locally or just change the file `config/initializers/cors.rb` to the following: +> ```ruby +> … +> allow do +> origins do |origin, env| +> Api::CorsCheck.new(ActionDispatch::Request.new(env)).allowed?(origin) +> end +> resource '*', +> … +> ``` + +## Starting hitobito + +To actually run hitobito you can use regular ruby/rails commands in the Terminal: +```sh +rails server -b 0.0.0.0 +``` + +The shell is already in the context of the ruby bundler. + +### Starting in VS Code + +For VS Code or Github Codespaces Users, you can even use the IDE features like setting breakpoints etc. + +To do so, there is a `.vscode/launch.json` file mounted. This allows you to go to the "Run and Debug" tab in the main navigation, select a Task from the dropdown and click the play button. It will launch hitobito or the specs in a separate panel and attach the debugger. + +## Rebuilding + +If you change something with the docker setup and/or change the Gemfile, simply rebuild the codespace. In VS Code this can easily be achieved by pressing Shift+Command+P (Mac) or Ctrl+Shift+P and then Entering `Rebuild Container`. + +To also freshly seed your database, type `Full Rebuild Container`. + +With both rebuilds, your changes are kept. To get a totally clean setup, delete your codespace and create a new one. + +If rebuild fails, you probably should update your hitobito repos first… + +## A note about committing and pushing + +When running the devcontainer locally, you should be able to commit and push as normal even from inside the container (vs code passes through authentication). Please keep in mind though, that the devcontainer clones the core and wagons via http and from the main repositories, so you probably first need to add your fork as a git remote (`git remote add `) + +When running in codespaces, it becomes a bit more tricky. I did not yet fully investigate this scenario, you might find some hints [here](https://docs.github.com/en/codespaces/managing-your-codespaces/managing-repository-access-for-your-codespaces) or [here](https://docs.github.com/en/codespaces/prebuilding-your-codespaces/allowing-a-prebuild-to-access-other-repositories). Please open a PR if you have this working and extend this documentation! + +## More + +If you want to dive deeper: [check here](DevcontainerInDepth.md) \ No newline at end of file diff --git a/doc/DevcontainerInDepth.md b/doc/DevcontainerInDepth.md new file mode 100644 index 0000000..49c39e6 --- /dev/null +++ b/doc/DevcontainerInDepth.md @@ -0,0 +1,44 @@ +# Devcontainers & GitHub Codespaces in Depth + +## How do devcontainers work? + +Essentially, there is a `devcontainer.json` in the `.devcontainer` folder which defines the devcontainer setup. + +This consist on a high level of the following: +- Define the docker compose file to use. In this repo, we also have a second `.devcontainer/docker-compose.yml`, which overrides some stuff form the main image. +- Define which service to user to run the IDE in +- Specify the workspace folder that gets opened by default inside the container +- Predefine some port mappings. They are supplemental to the docker compose ports… +- Some devcontainer setup commands + 1. initializeCommand: Runs outside of the container, before the container is being started. + 2. onCreateCommand: Runs inside the container after launching it, but before the IDE is available + 3. updateContentCommand: Runs inside the container after the onCreateCommant, but before the IDE is available. This is also rerun by github to update the prebuilt images. +- Some vscode extensions, that will get preinstalled. + +## What to the Scripts do? + +### initialize.sh + +The initialize.sh script is run outside the container, before it is launched. It clones the app repositories given to it as parameters. This is used to allow for all the variant/wagon setups to use almost the same setup. + +### create.sh + +The create.sh script is run inside the container after launching it, but before the IDE is available. It installs the ruby "debug" gem, which is needed for the ruby debugger to work. It then also runs the rails-entrypoint.sh script, which installs the gems, runs the migrations, seeds the database etc. + +### update.sh + +The update.sh script is run inside the container after the onCreateCommant, but before the IDE is available. This is also rerun by github to update the prebuilt images. It tries to pull all the wagon repositories, if they are not modified/fast forward is possible. It the reruns the rails-entrypoint.sh script, but skipping seeding the database and copying the wagonfiles. + +## Prebuilt Github Codespaces +Not gonna go into detail here. But the prebuilt github codespaces are a feature that allows to prebuild the devcontainer images, so that the first time a user opens a codespace, it is already prebuilt and ready to go. This is done by running all the scripts on a schedule and storing the resulting workspace as template. + +## Docker Access + +To access docker inside from the devcontainer: +- we mount the docker socket into the container +- we run the container as privileged +- we install docker-ce-cli inside the container + +This is a security risk for production, but not really a problem for development. + +The docker group is not available inside the container, so you always have to call docker as root, eg using sudo. If we would create it in the container, it's id would be different from the host, which would cause problems with the mounted socket. \ No newline at end of file diff --git a/doc/remote-dev-button.png b/doc/remote-dev-button.png new file mode 100644 index 0000000..716630e Binary files /dev/null and b/doc/remote-dev-button.png differ diff --git a/docker-compose.yml b/docker-compose.yml index 329d463..893332f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,14 +5,19 @@ services: context: ./docker dockerfile: rails.dockerfile image: ghcr.io/hitobito/development/rails + restart: unless-stopped user: "${RAILS_UID:-1000}" tty: true stdin_open: true depends_on: - - db - - mailcatcher - - cache - - webpack + db: + condition: service_healthy + mailcatcher: + condition: service_healthy + cache: + condition: service_started + webpack: + condition: service_started env_file: docker/rails.env environment: WEBPACKER_DEV_SERVER_HOST: webpack @@ -23,11 +28,19 @@ services: - ./app/:/usr/src/app - hitobito_bundle:/opt/bundle - seed:/seed - - ./docker/home/rails:/home/developer - - /tmp/.X11-unix:/tmp/.X11-unix + - ./docker/home/rails/.bashrc:/home/developer/.bashrc + - ./docker/home/rails/.pryrc:/home/developer/.pryrc + # Capybara can show the browser window on the host if the X11 socket is mounted… however this can brick on some systems (eg. Apple Silicon Macs) + #- /tmp/.X11-unix:/tmp/.X11-unix - ./docker/rails/work_around_docker_fs_bug.rb:/usr/src/app/hitobito/config/initializers/work_around_docker_fs_bug.rb:ro - /etc/timezone:/etc/timezone:ro - /etc/localtime:/etc/localtime:ro + - /var/run/docker.sock:/var/run/docker.sock + healthcheck: + test: [ "CMD", "curl", "--fail", "http://localhost:3000/healthz" ] + interval: 5s + timeout: 5s + start_period: 30m # `exec` into this to execute the tests of the core rails_test_core: @@ -43,7 +56,8 @@ services: SKIP_SEEDS: 1 SKIP_BUNDLE_INSTALL: 1 depends_on: - - db + db: + condition: service_healthy worker: <<: *rails @@ -54,29 +68,43 @@ services: SKIP_SEEDS: 1 SKIP_BUNDLE_INSTALL: 1 depends_on: - - rails - - db - - mailcatcher - - cache + rails: + condition: service_healthy + db: + condition: service_healthy + mailcatcher: + condition: service_healthy + cache: + condition: service_started + # Dependencies mailcatcher: + restart: unless-stopped image: ghcr.io/hitobito/development/mailcatcher build: context: ./docker dockerfile: mailcatcher.dockerfile ports: - "1080:1080" - + healthcheck: + test: [ "CMD", "curl", "--fail", "http://localhost:1080" ] + interval: 5s + timeout: 5s cache: + restart: unless-stopped image: memcached:1.6-alpine command: [ memcached, -l, '0.0.0.0', -p, '11211' ] sphinx: + restart: unless-stopped image: macbre/sphinxsearch:3.1.1 command: sphinx-start depends_on: - - db + db: + condition: service_healthy + rails: + condition: service_healthy volumes: - ./docker/sphinx.conf:/opt/sphinx/conf/sphinx.conf:ro - ./docker/sphinx-start:/usr/local/bin/sphinx-start:ro @@ -84,7 +112,8 @@ services: - sphinx_indexes:/opt/sphinx/indexes db: - image: mysql:5.7 + restart: unless-stopped + image: mariadb:10.2 command: - --sort_buffer_size=2M - --character-set-server=utf8mb4 @@ -103,8 +132,13 @@ services: - ./docker/mysql-setup.sql:/docker-entrypoint-initdb.d/mysql-setup.sql:ro - ./docker/test-setup.sql:/docker-entrypoint-initdb.d/test-setup.sql:ro - db:/var/lib/mysql + healthcheck: + test: [ "CMD", "mysqladmin", "ping", "--silent" ] + interval: 5s + timeout: 5s webpack: + restart: unless-stopped build: context: ./docker dockerfile: rails.dockerfile @@ -122,6 +156,9 @@ services: - ./app/:/usr/src/app - hitobito_bundle:/opt/bundle - hitobito_yarn_cache:/home/developer/.cache/yarn + depends_on: + db: + condition: service_healthy volumes: db: diff --git a/docker/home/rails/.gitignore b/docker/home/rails/.gitignore deleted file mode 100644 index bd61e3a..0000000 --- a/docker/home/rails/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -/.bundle -/.cache -/.pki -/.webdrivers \ No newline at end of file diff --git a/docker/rails-entrypoint.sh b/docker/rails-entrypoint.sh index ef5e2b2..10fdf46 100755 --- a/docker/rails-entrypoint.sh +++ b/docker/rails-entrypoint.sh @@ -39,10 +39,6 @@ initialize() { done fi - echo "⚙️ Testing DB connection" - timeout 300s waitfortcp "${RAILS_DB_HOST-db}" "${RAILS_DB_PORT-3306}" - echo "✅ DB server is ready" - if [ -z "$SKIP_RAILS_MIGRATIONS" ]; then echo "⚙️ Performing migrations" bundle exec rails db:migrate wagon:migrate diff --git a/docker/rails.dockerfile b/docker/rails.dockerfile index 9ea99da..1db3aea 100644 --- a/docker/rails.dockerfile +++ b/docker/rails.dockerfile @@ -14,7 +14,7 @@ ARG TRANSIFEX_VERSION="1.6.4" # Packages ARG BUILD_PACKAGES="nodejs git sqlite3 libsqlite3-dev imagemagick build-essential default-libmysqlclient-dev" -ARG DEV_PACKAGES="direnv xvfb chromium chromium-driver default-mysql-client pv vim curl less" +ARG DEV_PACKAGES="direnv xvfb chromium chromium-driver default-mysql-client pv vim curl less sudo docker-ce-cli" ################################# # Build Stage # @@ -27,19 +27,29 @@ USER root ENV RAILS_ENV=development ENV RAILS_DB_ADAPTER=mysql2 ENV BUNDLE_PATH=/opt/bundle +ARG USERNAME=hitobito +ARG USER_UID=1000 +ARG USER_GID=$USER_UID WORKDIR /usr/src/app/hitobito ARG NODEJS_VERSION RUN export DEBIAN_FRONTEND=noninteractive \ && apt-get update \ - && apt-get install -y ca-certificates curl gnupg \ + && apt-get install -y ca-certificates curl gnupg lsb-release \ && mkdir -p /etc/apt/keyrings \ && curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \ && echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_${NODEJS_VERSION}.x nodistro main" > /etc/apt/sources.list.d/nodesource.list \ && echo "Package: nodejs" >> /etc/apt/preferences.d/preferences \ && echo "Pin: origin deb.nodesource.com" >> /etc/apt/preferences.d/preferences \ - && echo "Pin-Priority: 1001" >> /etc/apt/preferences.d/preferences + && echo "Pin-Priority: 1001" >> /etc/apt/preferences.d/preferences \ + # Prepare Docker cli install to be able to use it in the devcontainer + && install -m 0755 -d /etc/apt/keyrings \ + && curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc \ + && chmod a+r /etc/apt/keyrings/docker.asc \ + && echo \ + "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \ + $(. /etc/os-release && echo "$VERSION_CODENAME") stable" > /etc/apt/sources.list.d/docker.list ARG BUILD_PACKAGES ARG DEV_PACKAGES @@ -58,16 +68,36 @@ RUN curl -L "https://github.com/transifex/cli/releases/download/v${TRANSIFEX_VER ARG BUNDLER_VERSION RUN bash -vxc "gem install bundler -v ${BUNDLER_VERSION}" + +# Create the user +RUN groupadd --gid $USER_GID $USERNAME \ + && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME -s /bin/bash -d /home/developer \ + # + # [Optional] Add sudo support. Omit if you don't need to install software after connecting. + && echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \ + && chmod 0440 /etc/sudoers.d/$USERNAME + +# Preinstall github.com ssh host keys +# This needs to be in /home/developer, since we have a non-standard home directory for the user $USERNAME +RUN mkdir -p /home/developer/.ssh \ + && echo "github.com ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOMqqnkVzrm0SdG6UOoqKLsabgH5C9okWi0dh2l9GKJl" >> /home/developer/.ssh/known_hosts \ + && echo "github.com ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBEmKSENjQEezOmxkZMy7opKgwFB9nkt5YRrYMjNuG5N87uRgg6CLrbo5wAdT/y6v0mKV0U2w0WZ2YB/++Tpockg=" >> /home/developer/.ssh/known_hosts \ + && echo "github.com ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCj7ndNxQowgcQnjshcLrqPEiiphnt+VTTvDP6mHBL9j1aNUkY4Ue1gvwnGLVlOhGeYrnZaMgRK6+PKCUXaDbC7qtbW8gIkhL7aGCsOr/C56SJMy/BCZfxd1nWzAOxSDPgVsmerOBYfNqltV9/hWCqBywINIR+5dIg6JTJ72pcEpEjcYgXkE2YEFXV1JHnsKgbLWNlhScqb2UmyRkQyytRLtL+38TGxkxCflmO+5Z8CSSNY7GidjMIZ7Q4zMjA2n1nGrlTDkzwDCsw+wqFPGQA179cnfGWOWRVruj16z6XyvxvjJwbz0wQZ75XK5tKSb7FNyeIEs4TT4jk+S4dhPeAUC5y+bDYirYgM4GC7uEnztnZyaVWQ7B381AK4Qdrwt51ZqExKbQpTUNn+EjqoTwvqNj4kqx5QUCI0ThS/YkOxJCXmPUWZbhjpCg56i+2aB6CmK2JGhn57K5mj0MNdBXA4/WnwH6XoPWJzK5Nyu2zB3nAZp+S5hpQs+p1vN1/wsjk=" >> /home/developer/.ssh/known_hosts \ + && chmod 600 /home/developer/.ssh/known_hosts \ + && /usr/bin/ssh-keygen -H -f /home/developer/.ssh/known_hosts \ + && chown -R $USERNAME:$USERNAME /home/developer/.ssh + # for release and version-scripts RUN bash -vxc 'gem install cmdparse pastel' COPY ./rails-entrypoint.sh /usr/local/bin COPY ./webpack-entrypoint.sh /usr/local/bin -COPY ./waitfortcp /usr/local/bin RUN mkdir /opt/bundle && chmod 777 /opt/bundle RUN mkdir /seed && chmod 777 /seed -RUN mkdir /home/developer && chmod 777 /home/developer + +USER $USERNAME + ENV HOME=/home/developer ENV NODE_PATH=/usr/lib/nodejs diff --git a/docker/waitfortcp b/docker/waitfortcp deleted file mode 100755 index d02a632..0000000 --- a/docker/waitfortcp +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -HOST=$1 -PORT=$2 - -while ! (echo >"/dev/tcp/$HOST/$PORT") &>/dev/null; do - echo "💤 Waiting for $HOST:$PORT to become available." - sleep 1 -done diff --git a/docker/webpack-entrypoint.sh b/docker/webpack-entrypoint.sh index 7addec5..2cac8c1 100755 --- a/docker/webpack-entrypoint.sh +++ b/docker/webpack-entrypoint.sh @@ -17,10 +17,6 @@ done echo "Running yarn install" bundle exec rails webpacker:yarn_install -echo "⚙️ Testing DB connection" -timeout 300s waitfortcp "${RAILS_DB_HOST-db}" "${RAILS_DB_PORT-3306}" -echo "✅ DB server is ready" - echo "➡️ Handing control over to '$*''" echo "⚙️ Executing: $@"