Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add devcontainer and Github Codespaces setup #43

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
d7bfb61
WIP: add devcontainer
cleverer Mar 25, 2023
e576930
WIP: multiple containers
cleverer Mar 25, 2023
1da9d39
WIP: fix builds
cleverer Mar 25, 2023
6a17c20
WIP: add configs
cleverer Mar 26, 2023
af619d0
WIP: correctly name dev containers
cleverer Mar 26, 2023
43fbd2b
feat: add tenant devcontainer
cleverer Mar 26, 2023
30639e6
WIP: add documentation for codespaces
cleverer Mar 26, 2023
ad4f360
Update docs and rebuild behaviour
cleverer Mar 26, 2023
9bfad99
Merge remote-tracking branch 'upstream/master' into pr-clever
BacLuc Mar 8, 2024
25bceac
.devcontainer/update.sh: add github.com to known_hosts
BacLuc Mar 8, 2024
400040f
readd app/* to .gitignore
BacLuc Mar 9, 2024
5564d55
Merge pull request #1 from BacLuc/pr-clever
cleverer Mar 9, 2024
0481ba4
WIP: make github host keys static
cleverer Mar 9, 2024
7c9f653
fix(compose): replace mysql with mariadb
cleverer Mar 9, 2024
c3c8d54
feat(compose): implement docker healthchecks
cleverer Mar 9, 2024
d68f5bc
fix(compose): mount less into home directory
cleverer Mar 9, 2024
8898b2e
fix: make devcontainer work with healthchecks
cleverer Mar 9, 2024
70743ad
fix(compose): make it work on apple silicon
cleverer Mar 9, 2024
9f48c96
fix(compose): make services restart
cleverer Mar 9, 2024
20b84db
feat: allow docker access from within container
cleverer Mar 10, 2024
018860a
fix: better setup dev user
cleverer Mar 10, 2024
d0683aa
fix(devcotainers): enhance documentation
cleverer Mar 11, 2024
b1b6be2
fix: remove unnecessary docker/home/rails/.gitignore
cleverer Mar 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .devcontainer/cevi/devcontainer.json
Original file line number Diff line number Diff line change
@@ -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"
]
}
}
}
7 changes: 7 additions & 0 deletions .devcontainer/create.sh
Original file line number Diff line number Diff line change
@@ -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!"
40 changes: 40 additions & 0 deletions .devcontainer/die_mitte/devcontainer.json
Original file line number Diff line number Diff line change
@@ -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"
]
}
}
}
40 changes: 40 additions & 0 deletions .devcontainer/digisus_lab/devcontainer.json
Original file line number Diff line number Diff line change
@@ -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"
]
}
}
}
31 changes: 31 additions & 0 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -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
40 changes: 40 additions & 0 deletions .devcontainer/dsj/devcontainer.json
Original file line number Diff line number Diff line change
@@ -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"
]
}
}
}
40 changes: 40 additions & 0 deletions .devcontainer/generic/devcontainer.json
Original file line number Diff line number Diff line change
@@ -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"
]
}
}
}
40 changes: 40 additions & 0 deletions .devcontainer/glp/devcontainer.json
Original file line number Diff line number Diff line change
@@ -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"
]
}
}
}
28 changes: 28 additions & 0 deletions .devcontainer/initialize.sh
Original file line number Diff line number Diff line change
@@ -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
40 changes: 40 additions & 0 deletions .devcontainer/insieme/devcontainer.json
Original file line number Diff line number Diff line change
@@ -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"
]
}
}
}
40 changes: 40 additions & 0 deletions .devcontainer/jubla/devcontainer.json
Original file line number Diff line number Diff line change
@@ -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"
]
}
}
}
Loading