Remove unused volumes from docker-compose.yml

This commit is contained in:
Eugene Burmakin 2025-01-09 20:51:19 +01:00
parent ae60a38e0c
commit 485f23f82d
13 changed files with 89 additions and 31 deletions

View file

@ -1 +1 @@
0.22.0
0.22.1

View file

@ -1,4 +1,4 @@
# Basis-Image für Ruby und Node.js
# Base-Image for Ruby and Node.js
FROM ruby:3.3.4-alpine
ENV APP_PATH=/var/app

View file

@ -8,7 +8,6 @@ services:
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:
@ -69,8 +68,6 @@ services:
POSTGRES_PASSWORD: password
volumes:
dawarich_db_data:
dawarich_gem_cache_app:
dawarich_gem_cache_sidekiq:
dawarich_shared:
dawarich_public:
dawarich_watched:

View file

@ -5,6 +5,39 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
# 0.22.1 - 2025-01-09
### Removed
- Gems caching volume from the `docker-compose.yml` file.
```diff
dawarich_app:
image: freikin/dawarich:latest
...
volumes:
- - dawarich_gem_cache_app:/usr/local/bundle/gems
...
dawarich_sidekiq:
image: freikin/dawarich:latest
...
volumes:
- - dawarich_gem_cache_app:/usr/local/bundle/gems
...
volumes:
dawarich_db_data:
- dawarich_gem_cache_app:
- dawarich_gem_cache_sidekiq:
dawarich_shared:
dawarich_public:
dawarich_watched:
```
### Changed
- `GET /api/v1/health` endpoint now returns a `X-Dawarich-Response: Hey, Im alive and authenticated!` header if user is authenticated.
# 0.22.0 - 2025-01-09
⚠️ This release introduces a breaking change. ⚠️
@ -13,7 +46,27 @@ Please read this release notes carefully before upgrading.
Docker-related files were moved to the `docker` directory and some of them were renamed. Before upgrading, study carefully changes in the `docker/docker-compose.yml` file and update your docker-compose file accordingly, so it uses the new files and commands. Copying `docker/docker-compose.yml` blindly may lead to errors.
No volumes were removed or renamed, so with a proper docker-compose file, you should be able to upgrade without any issues. To make it easier comparing your existing docker-compose file with the new one, you may use https://www.diffchecker.com/.
No volumes were removed or renamed, so with a proper docker-compose file, you should be able to upgrade without any issues.
To update existing `docker-compose.yml` to new changes, refer to the following:
```diff
dawarich_app:
image: freikin/dawarich:latest
...
- entrypoint: dev-entrypoint.sh
- command: ['bin/dev']
+ entrypoint: web-entrypoint.sh
+ command: ['bin/rails', 'server', '-p', '3000', '-b', '::']
...
dawarich_sidekiq:
image: freikin/dawarich:latest
...
- entrypoint: dev-entrypoint.sh
- command: ['bin/dev']
+ entrypoint: sidekiq-entrypoint.sh
+ command: ['bundle', 'exec', 'sidekiq']
```
Although `docker-compose.production.yml` was added, it's not being used by default. It's just an example of how to configure Dawarich for production. The default `docker-compose.yml` file is still recommended for running the app.

View file

@ -4,7 +4,12 @@ class Api::V1::HealthController < ApiController
skip_before_action :authenticate_api_key
def index
response.set_header('X-Dawarich-Response', 'Hey, I\'m alive!')
if current_api_user
response.set_header('X-Dawarich-Response', 'Hey, I\'m alive and authenticated!')
else
response.set_header('X-Dawarich-Response', 'Hey, I\'m alive!')
end
render json: { status: 'ok' }
end
end

View file

@ -5,6 +5,7 @@ ENV BUNDLE_VERSION=2.5.21
ENV BUNDLE_PATH=/usr/local/bundle/gems
ENV RAILS_LOG_TO_STDOUT=true
ENV RAILS_PORT=3000
ENV RAILS_ENV=development
# Install dependencies for application
RUN apk -U add --no-cache \
@ -30,12 +31,14 @@ RUN gem update --system 3.6.2 \
WORKDIR $APP_PATH
COPY ../Gemfile ../Gemfile.lock ../vendor ../.ruby-version ./
COPY ../Gemfile ../Gemfile.lock ../.ruby-version ../vendor ./
# Install all gems including development and test
# Install all gems into the image
RUN bundle config set --local path 'vendor/bundle' \
&& bundle install --jobs 4 --retry 3
&& bundle install --jobs 4 --retry 3 \
&& rm -rf vendor/bundle/ruby/3.3.0/cache/*.gem
# Copy the rest of the application
COPY ../. ./
# Copy entrypoint scripts and grant execution permissions

View file

@ -6,6 +6,8 @@ ENV BUNDLE_PATH=/usr/local/bundle/gems
ENV RAILS_LOG_TO_STDOUT=true
ENV RAILS_PORT=3000
ENV RAILS_ENV=production
ENV SECRET_KEY_BASE=$SECRET_KEY_BASE
# Install dependencies for application
RUN apk -U add --no-cache \
@ -31,11 +33,13 @@ RUN gem update --system 3.6.2 \
WORKDIR $APP_PATH
COPY ../Gemfile ../Gemfile.lock ../vendor ../.ruby-version ./
COPY ../Gemfile ../Gemfile.lock ../.ruby-version ../vendor ./
# Install production gems only
RUN bundle config set --local path 'vendor/bundle' \
&& bundle install --jobs 4 --retry 3 --without development test
&& bundle config set --local without 'development test' \
&& bundle install --jobs 4 --retry 3 \
&& rm -rf vendor/bundle/ruby/3.3.0/cache/*.gem
COPY ../. ./

View file

@ -39,7 +39,6 @@ services:
image: freikin/dawarich:latest
container_name: dawarich_app
volumes:
- dawarich_gem_cache_app:/usr/local/bundle/gems
- dawarich_public:/var/app/public
- dawarich_watched:/var/app/tmp/imports/watched
networks:
@ -97,7 +96,6 @@ services:
image: freikin/dawarich:latest
container_name: dawarich_sidekiq
volumes:
- dawarich_gem_cache_sidekiq:/usr/local/bundle/gems
- dawarich_public:/var/app/public
- dawarich_watched:/var/app/tmp/imports/watched
networks:
@ -154,7 +152,5 @@ services:
volumes:
dawarich_db_data:
dawarich_redis_data:
dawarich_gem_cache_app:
dawarich_gem_cache_sidekiq:
dawarich_public:
dawarich_watched:

View file

@ -41,7 +41,6 @@ services:
image: freikin/dawarich:latest
container_name: dawarich_app
volumes:
- dawarich_gem_cache_app:/usr/local/bundle/gems
- dawarich_public:/var/app/public
- dawarich_watched:/var/app/tmp/imports/watched
networks:
@ -97,7 +96,6 @@ services:
image: freikin/dawarich:latest
container_name: dawarich_sidekiq
volumes:
- dawarich_gem_cache_sidekiq:/usr/local/bundle/gems
- dawarich_public:/var/app/public
- dawarich_watched:/var/app/tmp/imports/watched
networks:
@ -151,8 +149,6 @@ services:
volumes:
dawarich_db_data:
dawarich_gem_cache_app:
dawarich_gem_cache_sidekiq:
dawarich_shared:
dawarich_public:
dawarich_watched:

View file

@ -3,10 +3,6 @@ networks:
volumes:
dawarich_gem_cache_app:
name: dawarich_gem_cache_app
dawarich_gem_cache_sidekiq:
name: dawarich_gem_cache_sidekiq
dawarich_public:
name: dawarich_public
dawarich_keydb:
@ -49,7 +45,6 @@ services:
entrypoint: dev-entrypoint.sh
command: [ 'bin/dev' ]
volumes:
- dawarich_gem_cache_app:/usr/local/bundle/gems
- dawarich_public:/var/app/dawarich_public
- watched:/var/app/tmp/imports/watched
healthcheck:
@ -102,7 +97,6 @@ services:
entrypoint: dev-entrypoint.sh
command: [ 'sidekiq' ]
volumes:
- dawarich_gem_cache_sidekiq:/usr/local/bundle/gems
- dawarich_public:/var/app/dawarich_public
- watched:/var/app/tmp/imports/watched
logging:

View file

@ -29,7 +29,7 @@ If you don't want to use dedicated share for projects installed by docker skip i
### Dawarich root folder
1. Open your [Docker root folder](#docker-root-share) in **File station**.
2. Create new folder **dawarich** and open it.
3. Create folders **redis**, **db_data**, **db_shared**, **gem_cache** and **public** in **dawarich** folder.
3. Create folders **redis**, **db_data**, **db_shared** and **public** in **dawarich** folder.
4. Copy [docker compose](synology/docker-compose.yml) and [.env](synology/.env) files form **synology** repo folder into **dawarich** folder on your synology.
# Installation

View file

@ -8,7 +8,7 @@ services:
restart: unless-stopped
volumes:
- ./redis:/var/shared/redis
dawarich_db:
image: postgres:14.2-alpine
container_name: dawarich_db
@ -34,11 +34,10 @@ services:
env_file:
- .env
volumes:
- ./gem_cache:/usr/local/bundle/gems
- ./public:/var/app/public
ports:
- 32568:3000
dawarich_sidekiq:
image: freikin/dawarich:latest
container_name: dawarich_sidekiq
@ -52,5 +51,4 @@ services:
env_file:
- .env
volumes:
- ./gem_cache:/usr/local/bundle/gems
- ./public:/var/app/public

View file

@ -9,6 +9,18 @@ RSpec.describe 'Api::V1::Healths', type: :request do
get '/api/v1/health'
expect(response).to have_http_status(:success)
expect(response.headers['X-Dawarich-Response']).to eq('Hey, I\'m alive!')
end
end
context 'when user is authenticated' do
let(:user) { create(:user) }
it 'returns http success' do
get '/api/v1/health', headers: { 'Authorization' => "Bearer #{user.api_key}" }
expect(response).to have_http_status(:success)
expect(response.headers['X-Dawarich-Response']).to eq('Hey, I\'m alive and authenticated!')
end
end
end