mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-11 09:41:40 -05:00
Add devcontainer to dawarich
This commit is contained in:
parent
c159b56e25
commit
f39ab93196
5 changed files with 171 additions and 0 deletions
42
.devcontainer/Dockerfile
Normal file
42
.devcontainer/Dockerfile
Normal file
|
|
@ -0,0 +1,42 @@
|
||||||
|
# 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 install bundler --version "$BUNDLE_VERSION" \
|
||||||
|
&& rm -rf $GEM_HOME/cache/*
|
||||||
|
|
||||||
|
RUN adduser -D -h ${APP_PATH} vscode
|
||||||
|
|
||||||
|
# Navigate to app directory
|
||||||
|
WORKDIR $APP_PATH
|
||||||
|
|
||||||
|
USER vscode
|
||||||
|
|
||||||
|
EXPOSE $RAILS_PORT
|
||||||
|
|
||||||
|
|
||||||
17
.devcontainer/devcontainer.json
Normal file
17
.devcontainer/devcontainer.json
Normal file
|
|
@ -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-Unterstützung
|
||||||
|
"esbenp.prettier-vscode", // Prettier für JS-Formatierung
|
||||||
|
"dbaeumer.vscode-eslint" // ESLint für JavaScript
|
||||||
|
],
|
||||||
|
"postCreateCommand": "yarn install && bundle config set --local path 'vendor/bundle' && bundle install --jobs 20 --retry 5",
|
||||||
|
"forwardPorts": [3000], // Weiterleitung für Rails-Server
|
||||||
|
"remoteUser": "vscode",
|
||||||
|
"workspaceFolder": "/var/app"
|
||||||
|
}
|
||||||
79
.devcontainer/docker-compose.yml
Normal file
79
.devcontainer/docker-compose.yml
Normal file
|
|
@ -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:
|
||||||
9
.gitignore
vendored
9
.gitignore
vendored
|
|
@ -51,3 +51,12 @@
|
||||||
!/app/assets/builds/.keep
|
!/app/assets/builds/.keep
|
||||||
.DS_Store
|
.DS_Store
|
||||||
.env
|
.env
|
||||||
|
|
||||||
|
.devcontainer/.onCreateCommandMarker
|
||||||
|
.devcontainer/.postCreateCommandMarker
|
||||||
|
.devcontainer/.updateContentCommandMarker
|
||||||
|
|
||||||
|
.vscode-server/
|
||||||
|
.ash_history
|
||||||
|
.cache/
|
||||||
|
.dotnet/
|
||||||
|
|
|
||||||
24
DEVELOPMENT.md
Normal file
24
DEVELOPMENT.md
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
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:create
|
||||||
|
bundle exec rails db:prepare
|
||||||
|
bundle exec rake data:migrate
|
||||||
|
bundle exec rake db:seed
|
||||||
|
```
|
||||||
|
|
||||||
|
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.
|
||||||
Loading…
Reference in a new issue