-
-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #546 from tabacha/2024-12-15-devcontainer
Add devcontainer to dawarich
- Loading branch information
Showing
5 changed files
with
167 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Basis-Image für Ruby und Node.js | ||
FROM ruby:3.3.4-alpine | ||
|
||
ENV APP_PATH=/var/app | ||
ENV BUNDLE_VERSION=2.5.9 | ||
ENV BUNDLE_PATH=/usr/local/bundle/gems | ||
ENV TMP_PATH=/tmp/ | ||
ENV RAILS_LOG_TO_STDOUT=true | ||
ENV RAILS_PORT=3000 | ||
|
||
# Install dependencies for application | ||
RUN apk -U add --no-cache \ | ||
build-base \ | ||
git \ | ||
postgresql-dev \ | ||
postgresql-client \ | ||
libxml2-dev \ | ||
libxslt-dev \ | ||
nodejs \ | ||
yarn \ | ||
imagemagick \ | ||
tzdata \ | ||
less \ | ||
yaml-dev \ | ||
# gcompat for nokogiri on mac m1 | ||
gcompat \ | ||
&& rm -rf /var/cache/apk/* \ | ||
&& mkdir -p $APP_PATH | ||
|
||
RUN gem update --system 3.5.7 && gem install bundler --version "$BUNDLE_VERSION" \ | ||
&& rm -rf $GEM_HOME/cache/* | ||
|
||
# FIXME It would be a good idea to use a other user than root, but this lead to permission error on export and maybe more yet. | ||
# RUN adduser -D -h ${APP_PATH} vscode | ||
USER root | ||
|
||
# Navigate to app directory | ||
WORKDIR $APP_PATH | ||
|
||
EXPOSE $RAILS_PORT | ||
|
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,17 @@ | ||
{ | ||
"name": "Ruby and Node DevContainer", | ||
"dockerComposeFile": ["docker-compose.yml"], | ||
"service": "dawarich_dev", | ||
"settings": { | ||
"terminal.integrated.defaultProfile.linux": "bash" | ||
}, | ||
"extensions": [ | ||
"rebornix.ruby", // Ruby-Support | ||
"esbenp.prettier-vscode", // Prettier for JS-Formating | ||
"dbaeumer.vscode-eslint" // ESLint for JavaScript | ||
], | ||
"postCreateCommand": "yarn install && bundle config set --local path 'vendor/bundle' && bundle install --jobs 20 --retry 5", | ||
"forwardPorts": [3000], // Redirect to Rails-App-Server | ||
"remoteUser": "root", | ||
"workspaceFolder": "/var/app" | ||
} |
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,79 @@ | ||
networks: | ||
dawarich: | ||
services: | ||
dawarich_dev: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
container_name: dawarich_dev | ||
volumes: | ||
- "${PWD}:/var/app:cached" | ||
- dawarich_gem_cache_app:/usr/local/bundle/gems_app | ||
- dawarich_public:/var/app/public | ||
- dawarich_watched:/var/app/tmp/imports/watched | ||
networks: | ||
- dawarich | ||
ports: | ||
- 3000:3000 | ||
- 9394:9394 | ||
stdin_open: true | ||
tty: true | ||
environment: | ||
RAILS_ENV: development | ||
REDIS_URL: redis://dawarich_redis:6379/0 | ||
DATABASE_HOST: dawarich_db | ||
DATABASE_USERNAME: postgres | ||
DATABASE_PASSWORD: password | ||
DATABASE_NAME: dawarich_development | ||
MIN_MINUTES_SPENT_IN_CITY: 60 | ||
APPLICATION_HOST: localhost | ||
APPLICATION_HOSTS: localhost | ||
TIME_ZONE: Europe/London | ||
APPLICATION_PROTOCOL: http | ||
DISTANCE_UNIT: km | ||
PHOTON_API_HOST: photon.komoot.io | ||
PHOTON_API_USE_HTTPS: true | ||
PROMETHEUS_EXPORTER_ENABLED: false | ||
PROMETHEUS_EXPORTER_HOST: 0.0.0.0 | ||
PROMETHEUS_EXPORTER_PORT: 9394 | ||
ENABLE_TELEMETRY: false # More on telemetry: https://dawarich.app/docs/tutorials/telemetry | ||
dawarich_redis: | ||
image: redis:7.0-alpine | ||
container_name: dawarich_redis | ||
command: redis-server | ||
networks: | ||
- dawarich | ||
volumes: | ||
- dawarich_shared:/data | ||
restart: always | ||
healthcheck: | ||
test: [ "CMD", "redis-cli", "--raw", "incr", "ping" ] | ||
interval: 10s | ||
retries: 5 | ||
start_period: 30s | ||
timeout: 10s | ||
dawarich_db: | ||
image: postgres:14.2-alpine | ||
container_name: dawarich_db | ||
volumes: | ||
- dawarich_db_data:/var/lib/postgresql/data | ||
- dawarich_shared:/var/shared | ||
networks: | ||
- dawarich | ||
restart: always | ||
healthcheck: | ||
test: [ "CMD-SHELL", "pg_isready -U postgres -d dawarich_development" ] | ||
interval: 10s | ||
retries: 5 | ||
start_period: 30s | ||
timeout: 10s | ||
environment: | ||
POSTGRES_USER: postgres | ||
POSTGRES_PASSWORD: password | ||
volumes: | ||
dawarich_db_data: | ||
dawarich_gem_cache_app: | ||
dawarich_gem_cache_sidekiq: | ||
dawarich_shared: | ||
dawarich_public: | ||
dawarich_watched: |
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,21 @@ | ||
If you want to develop with dawarich you can use the devcontainer, with your IDE. It is tested with visual studio code. | ||
|
||
Load the directory in Vs-Code and press F1. And Run the command: `Dev Containers: Rebuild Containers` after a while you should see a terminal. | ||
|
||
Now you can create/prepare the Database (this need to be done once): | ||
```bash | ||
bundle exec rails db:prepare | ||
``` | ||
|
||
Afterwards you can run sidekiq: | ||
```bash | ||
bundle exec sidekiq | ||
|
||
``` | ||
|
||
And in a second terminal the dawarich-app: | ||
```bash | ||
bundle exec bin/dev | ||
``` | ||
|
||
You can connect with a web browser to http://127.0.0.l:3000/ and login with the default credentials. |