From a4f03e930bba538226b766f4bb7c131e7da0745c Mon Sep 17 00:00:00 2001 From: root Date: Thu, 7 Sep 2023 22:18:22 +0000 Subject: [PATCH] updated to make work some settings --- Dockerfile | 4 ++-- Gemfile.lock | 4 ++++ config/application.rb | 2 +- docker-compose.yml | 17 ++++++++++++++--- nginx/conf/nginx.conf | 19 ++++++++++++------- 5 files changed, 33 insertions(+), 13 deletions(-) diff --git a/Dockerfile b/Dockerfile index 9615fcf..74d9cd9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,8 @@ FROM ruby:3 RUN apt-get update WORKDIR /app -COPY Gemfile* . +COPY Gemfile* ./ RUN bundle install COPY . . EXPOSE 3000 -CMD ["rails", "server", "-b", "0.0.0.0"] \ No newline at end of file +CMD ["rails", "server", "-b", "benchcoach-dev.ascorrea.com"] diff --git a/Gemfile.lock b/Gemfile.lock index 14e878e..9354ff8 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -170,6 +170,8 @@ GEM racc (~> 1.4) nokogiri (1.15.4-arm64-darwin) racc (~> 1.4) + nokogiri (1.15.4-x86_64-linux) + racc (~> 1.4) oauth2 (2.0.9) faraday (>= 0.17.3, < 3.0) jwt (>= 1.0, < 3.0) @@ -254,6 +256,7 @@ GEM sprockets (>= 3.0.0) sqlite3 (1.6.3-aarch64-linux) sqlite3 (1.6.3-arm64-darwin) + sqlite3 (1.6.3-x86_64-linux) stimulus-rails (1.2.2) railties (>= 6.0.0) teamsnap_rb (3.0.3) @@ -300,6 +303,7 @@ GEM PLATFORMS aarch64-linux arm64-darwin-22 + x86_64-linux DEPENDENCIES bootsnap diff --git a/config/application.rb b/config/application.rb index 80624ad..752eca4 100644 --- a/config/application.rb +++ b/config/application.rb @@ -13,7 +13,7 @@ module TeamsnapBenchcoachRails # Initialize configuration defaults for originally generated Rails version. config.load_defaults 7.0 config.active_record.default_timezone = :local - config.hosts << 'smithers.local' + config.hosts << 'benchcoach-dev.ascorrea.com' # Configuration for the application, engines, and railties goes here. # # These settings can be overridden in specific environments using the files diff --git a/docker-compose.yml b/docker-compose.yml index 2ee1b55..98a7813 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,18 +1,25 @@ +version: "3.3" services: - web: + app: build: . command: bash -c "rm -f tmp/pids/server.pid && bundle exec rails s -p 3000 -b '0.0.0.0'" + hostname: app volumes: - .:/app ports: - "3000:3000" - + networks: + - internal + environment: + TEAMSNAP_CLIENT_ID: "${TEAMSNAP_CLIENT_ID}" + TEAMSNAP_CLIENT_SECRET: "${TEAMSNAP_CLIENT_SECRET}" webserver: image: nginx:latest ports: - 80:80 - 443:443 - restart: always + networks: + - internal volumes: - ./nginx/conf/:/etc/nginx/conf.d/:ro - ./certbot/www:/var/www/certbot/:ro @@ -22,3 +29,7 @@ services: volumes: - ./certbot/www/:/var/www/certbot/:rw - ./certbot/conf/:/etc/letsencrypt/:rw + +networks: + internal: + driver: bridge diff --git a/nginx/conf/nginx.conf b/nginx/conf/nginx.conf index cb12bb8..42b60c1 100644 --- a/nginx/conf/nginx.conf +++ b/nginx/conf/nginx.conf @@ -2,7 +2,7 @@ server { listen 80; listen [::]:80; - server_name benchcoach.online www.benchcoach.online; + server_name benchcoach-dev.ascorrea.com; server_tokens off; location /.well-known/acme-challenge/ { @@ -10,7 +10,7 @@ server { } location / { - return 301 https://benchcoach.online$request_uri; + return 301 https://benchcoach-dev.ascorrea.com$request_uri; } } @@ -18,12 +18,17 @@ server { listen 443 default_server ssl http2; listen [::]:443 ssl http2; - server_name benchcoach.online; + server_name benchcoach-dev.ascorrea.com; - ssl_certificate /etc/nginx/ssl/live/benchcoach.online/fullchain.pem; - ssl_certificate_key /etc/nginx/ssl/live/benchcoach.online/privkey.pem; + ssl_certificate /etc/nginx/ssl/live/benchcoach-dev.ascorrea.com/fullchain.pem; + ssl_certificate_key /etc/nginx/ssl/live/benchcoach-dev.ascorrea.com/privkey.pem; location / { - # ... + proxy_set_header Host $http_host; + proxy_set_header Client-IP $remote_addr; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $remote_addr; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_pass http://app:3000/; } -} \ No newline at end of file +}