-
Notifications
You must be signed in to change notification settings - Fork 76
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
Feature: Added Github codespaces configurations #1541 #1557
Merged
akhilgkrishnan
merged 29 commits into
saeloun:develop
from
Shrest4647:feature/codespaces-configurations
Oct 19, 2023
Merged
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
b5c331b
Add VSCode codespace support for dev enviroment
akhilgkrishnan 86b329e
VSCode settings added
akhilgkrishnan 160d3ef
Elasticport added
akhilgkrishnan 78af86c
Intendation fix
akhilgkrishnan b084360
Docker compose fix
akhilgkrishnan 944b14a
Docker compose fix
akhilgkrishnan 1744671
fix container
akhilgkrishnan 318d9bd
feature(devcontainer): updated devcontainer configurations
Shrest4647 f6a2f68
feat(docker): Updated the docker files
Shrest4647 5c22004
fix(file): fix for the file encoding problem with lf and crlf
Shrest4647 4e21fb1
fix(db): get db host from env
Shrest4647 bcea023
fix(docker): remove args from compose
Shrest4647 7bab963
fix(db): removing the port mapping
Shrest4647 cacc9ed
fix(compose): remove the network mode
Shrest4647 9965bfe
fix(devcontainer): reorderd start command
Shrest4647 5bc7728
fix(devcontainer): removing all post install commands
Shrest4647 c33cca6
fix(devcontainer): added post attach command
Shrest4647 fadaf0b
fix(docker): updated the mount folder
Shrest4647 665bc2a
fix(devcontainer): playing with install order
Shrest4647 efb916d
chore(devcontainer): running clean ups
Shrest4647 3655623
Merge branch 'develop' into feature/codespaces-configurations
Shrest4647 cb96337
feat(codespaces): configuration to allow requests from the codespaces…
Shrest4647 437025a
Merge branch 'feature/codespaces-configurations' of https://github.co…
Shrest4647 2e04aca
Merge branch 'develop' into feature/codespaces-configurations
Shrest4647 b14e7cb
chore(script): deleted the unused script file
Shrest4647 7446234
Merge branch 'feature/codespaces-configurations' of https://github.co…
Shrest4647 1b026dc
Rubocop fix
akhilgkrishnan 1c94061
Fixed actiondispatch issue and added base url
akhilgkrishnan dde5039
Removed deprecated the extensions
akhilgkrishnan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
@@ -0,0 +1,71 @@ | ||
#syntax=docker/dockerfile:1 | ||
ARG VARIANT=3.2 | ||
FROM mcr.microsoft.com/vscode/devcontainers/ruby:${VARIANT} AS base | ||
|
||
# Update args in docker-compose.yaml to set the UID/GID of the "vscode" user. | ||
# ARG USER_UID=1000 | ||
# ARG USER_GID=$USER_UID | ||
# RUN if [ "$USER_GID" != "1000" ] || [ "$USER_UID" != "1000" ]; then \ | ||
# groupmod --gid $USER_GID vscode \ | ||
# && usermod --uid $USER_UID --gid $USER_GID vscode \ | ||
# && chmod -R $USER_UID:$USER_GID /home/vscode; \ | ||
# fi | ||
|
||
ARG NODE_VERSION=18.14.2 | ||
|
||
ENV BUNDLE_PATH="/usr/local/bundle" | ||
ENV GEM_HOME="/usr/local/bundle/gems" | ||
ENV GEM_PATH="/usr/local/bundle/gems" | ||
|
||
RUN mkdir /app | ||
WORKDIR /app | ||
RUN mkdir -p tmp/pids | ||
|
||
RUN apt-get update && apt-get install -y --no-install-recommends curl gnupg2 && \ | ||
echo "deb https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list && \ | ||
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \ | ||
curl -sL https://deb.nodesource.com/setup_lts.x | bash - && \ | ||
apt-get install -y --no-install-recommends nodejs yarn && \ | ||
npm --version && \ | ||
apt-get clean && rm -rf /var/lib/apt/lists/* /var/cache/apt/archives/* | ||
|
||
|
||
RUN curl --location --silent https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \ | ||
&& sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \ | ||
&& apt-get update && apt-get install google-chrome-stable -y --no-install-recommends postgresql-client && \ | ||
apt-get clean && rm -rf /var/lib/apt/lists/* /var/cache/apt/archives/* | ||
|
||
# Install gh | ||
RUN curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \ | ||
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \ | ||
&& sudo apt update \ | ||
&& sudo apt install gh | ||
|
||
|
||
FROM base AS build-deps | ||
|
||
RUN apt-get update && apt-get install -y --no-install-recommends git build-essential libpq-dev && \ | ||
apt-get clean && rm -rf /var/lib/apt/lists/* /var/cache/apt/archives/* | ||
|
||
|
||
FROM build-deps AS gems | ||
|
||
RUN gem install bundler -v 2.3.11 | ||
|
||
COPY Gemfile Gemfile.lock ./ | ||
|
||
RUN bundle install && rm -rf vendor/bundle/ruby/*/cache | ||
|
||
FROM base AS node_modules | ||
|
||
COPY package.json yarn.lock ./ | ||
|
||
RUN yarn install --check-files | ||
|
||
FROM base | ||
|
||
|
||
COPY --from=gems /app /app | ||
COPY --from=gems /usr/local/bundle /usr/local/bundle | ||
COPY --from=node_modules /app/node_modules /app/node_modules | ||
COPY . ./ |
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 @@ | ||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the | ||
// README at: https://github.com/devcontainers/templates/tree/main/src/docker-existing-docker-compose | ||
{ | ||
"name": "Miru Web Codespace", | ||
// Update the 'dockerComposeFile' list if you have more compose files or use different names. | ||
// The .devcontainer/docker-compose.yml file contains any overrides you need/want to make. | ||
"dockerComposeFile": "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": "app", | ||
// The optional 'workspaceFolder' property is the path VS Code should open by default when | ||
// connected. This is typically a file mount in .devcontainer/docker-compose.yml | ||
"workspaceFolder": "/app", | ||
// Features to add to the dev container. More info: https://containers.dev/features. | ||
// "features": {}, | ||
"customizations": { | ||
"vscode": { | ||
// Add the IDs of extensions you want installed when the container is created. | ||
"extensions": [ | ||
"Shopify.ruby-lsp", | ||
"misogi.ruby-rubocop", | ||
"davidpallinder.rails-test-runner", | ||
"eamodio.gitlens", | ||
"github.copilot", | ||
"mrmlnc.vscode-duplicate" | ||
], | ||
"settings": { | ||
"terminal.integrated.shell.linux": "/bin/zsh" | ||
} | ||
} | ||
}, | ||
// Use 'forwardPorts' to make a list of ports inside the container available locally. | ||
"forwardPorts": [ | ||
3000, | ||
3035, | ||
9200 | ||
], | ||
// Uncomment the next line if you want start specific services in your Docker Compose config. | ||
// "runServices": [], | ||
// Uncomment the next line if you want to keep your containers running after VS Code shuts down. | ||
// "shutdownAction": "none", | ||
// Uncomment the next line to run commands after the container is created. | ||
// "postCreateCommand": "", | ||
"postAttachCommand": "bundle exec rails s -p 3000 -b 0.0.0.0 && bundle exec rails db:prepare", | ||
// Configure tool-specific properties. | ||
// "customizations": {}, | ||
// Uncomment to connect as an existing user other than the container default. More info: https://aka.ms/dev-containers-non-root. | ||
"remoteEnv": { | ||
"APP_BASE_URL": "${localEnv:CODESPACE_NAME}-3000.${localEnv:GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN}", | ||
}, | ||
|
||
"remoteUser": "root", | ||
"portsAttributes": { | ||
"3000": { | ||
"label": "Rails Server" | ||
}, | ||
"3035": { | ||
"label": "Webpack Dev Server" | ||
}, | ||
"9200": { | ||
"label": "Elasticsearch" | ||
} | ||
} | ||
} |
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,126 @@ | ||
version: "3.9" | ||
services: | ||
app: | ||
build: | ||
context: .. | ||
dockerfile: .devcontainer/Dockerfile | ||
# command: bash -c "bundle install && bundle exec rails db:prepare && bundle exec rails s -p 3000 -b 0.0.0.0" || sleep infinity | ||
# Overrides default command so things don't shut down after the process ends. | ||
command: sleep infinity | ||
ports: | ||
- "3000:3000" | ||
image: miru-web:latest | ||
working_dir: /app | ||
volumes: | ||
- ../:/app | ||
- gem_cache:/usr/local/bundle/gems | ||
- node_modules:/app/node_modules | ||
environment: | ||
- WEBPACKER_DEV_SERVER_HOST=0.0.0.0 | ||
- DATABASE_URL=postgres://postgres:postgres@database:5432/ | ||
- DB_HOST=database | ||
- DB_USER=postgres | ||
- DB_PASS=postgres | ||
- DATABASE_CLEANER_ALLOW_REMOTE_DATABASE_URL="true" | ||
- POSTGRES_PASSWORD="postgres" | ||
- POSTGRES_USER="postgres" | ||
- REDIS_URL=redis://redis:6379/1 | ||
- ELASTICSEARCH_URL=http://elastic:x2Sy5FK51zu@elasticsearch:9200 | ||
- PIDFILE=/tmp/pids/server.pid | ||
depends_on: | ||
- database | ||
- redis | ||
- elasticsearch | ||
tmpfs: | ||
- /tmp/pids/ | ||
# Runs app on the same network as the database container, allows "forwardPorts" in devcontainer.json function. | ||
# network_mode: service:database | ||
# Use "forwardPorts" in **devcontainer.json** to forward an app port locally. | ||
# (Adding the "ports" property to this file will not forward from a Codespace.) | ||
|
||
database: | ||
image: postgres:13.8 | ||
restart: unless-stopped | ||
# ports: | ||
# - "5432:5432" | ||
volumes: | ||
- postgres:/var/lib/postgresql/data | ||
environment: | ||
POSTGRES_USER: postgres | ||
POSTGRES_DB: postgres | ||
POSTGRES_PASSWORD: postgres | ||
# Your config/database.yml should use the user and password you set here, | ||
# and host "db" (as that's the name of this service). You can use whatever | ||
# database name you want. Use `bin/rails db:prepare` to create the database. | ||
# | ||
# Example: | ||
# | ||
# development: | ||
# <<: *default | ||
# host: db | ||
# username: postgres | ||
# password: postgres | ||
# database: myapp_development | ||
|
||
# Add "forwardPorts": ["5432"] to **devcontainer.json** to forward PostgreSQL locally. | ||
# (Adding the "ports" property to this file will not forward from a Codespace.) | ||
redis: | ||
image: redis:6.2.7 | ||
command: redis-server | ||
restart: always | ||
ports: | ||
- "6379:6379" | ||
volumes: | ||
- redis:/data | ||
|
||
webpack: | ||
build: | ||
context: .. | ||
dockerfile: .devcontainer/Dockerfile | ||
command: bin/webpacker-dev-server | ||
image: miru-web:latest | ||
ports: | ||
- "3035:3035" | ||
environment: | ||
- WEBPACKER_DEV_SERVER_HOST=0.0.0.0 | ||
- DATABASE_URL=postgres://postgres:postgres@database:5432/ | ||
- DATABASE_CLEANER_ALLOW_REMOTE_DATABASE_URL="true" | ||
- POSTGRES_PASSWORD="postgres" | ||
- POSTGRES_USER="postgres" | ||
- REDIS_URL=redis://redis:6379/1 | ||
- ELASTICSEARCH_URL=http://elastic:x2Sy5FK51zu@elasticsearch:9200 | ||
depends_on: | ||
- database | ||
|
||
sidekiq: | ||
build: | ||
context: .. | ||
dockerfile: .devcontainer/Dockerfile | ||
command: bundle exec sidekiq -C config/sidekiq.yml | ||
volumes: | ||
- ..:/app | ||
- gem_cache:/usr/local/bundle/gems | ||
- node_modules:/app/node_modules | ||
environment: | ||
- DATABASE_URL=postgres://postgres:postgres@database:5432/ | ||
- REDIS_URL=redis://redis:6379/1 | ||
depends_on: | ||
- redis | ||
- database | ||
- app | ||
|
||
elasticsearch: | ||
image: elasticsearch:7.13.3 | ||
environment: | ||
discovery.type: single-node | ||
network.host: 0.0.0.0 | ||
xpack.security.enabled: "true" | ||
ELASTIC_PASSWORD: "x2Sy5FK51zu" | ||
ports: | ||
- "9200:9200" | ||
|
||
volumes: | ||
gem_cache: | ||
postgres: | ||
node_modules: | ||
redis: |
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,22 +1,24 @@ | ||
{ | ||
"[ruby]": { | ||
"editor.autoClosingBrackets": "beforeWhitespace", | ||
"editor.formatOnSave": true, | ||
"editor.defaultFormatter": "rebornix.ruby" | ||
}, | ||
"files.trimTrailingWhitespace": true, | ||
"files.trimFinalNewlines": true, | ||
"[ruby]": { | ||
"editor.autoClosingBrackets": "beforeWhitespace", | ||
"editor.formatOnSave": true, | ||
"yaml.format.enable": true, | ||
"ruby.useBundler": true, //run non-lint commands with bundle exec | ||
"ruby.useLanguageServer": true, // use the internal language server (see below) | ||
"ruby.lint": { | ||
"rubocop": { | ||
"useBundler": true, | ||
"lint": true, // enable lint cops | ||
"rails": true // requires rubocop-rails gem for RuboCop >= 0.72.0 | ||
} | ||
}, | ||
"ruby.format": "rubocop", | ||
"ruby.intellisense": "rubyLocate" | ||
} | ||
"editor.defaultFormatter": "rebornix.ruby", | ||
"editor.tabSize": 2, | ||
}, | ||
"files.trimTrailingWhitespace": true, | ||
"files.trimFinalNewlines": true, | ||
"editor.formatOnSave": true, | ||
"yaml.format.enable": true, | ||
"ruby.useBundler": true, //run non-lint commands with bundle exec | ||
"ruby.useLanguageServer": true, // use the internal language server (see below) | ||
"ruby.lint": { | ||
"rubocop": { | ||
"useBundler": true, | ||
"lint": true, // enable lint cops | ||
"rails": true // requires rubocop-rails gem for RuboCop >= 0.72.0 | ||
} | ||
}, | ||
"ruby.format": "rubocop", | ||
"ruby.intellisense": "rubyLocate", | ||
"files.eol": "\n" | ||
} |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the indentation is correct for this page. Use 2 spaces?