many important fixes

This commit is contained in:
2020-02-29 11:43:00 -05:00
parent 2149345d3d
commit 73c207c324
28 changed files with 1463 additions and 242 deletions
+17 -6
View File
@@ -1,12 +1,22 @@
FROM ruby:2.2.0
FROM ruby:2.7-slim
#NOTE: this file must be built from the parent (../) directory
# look at the
# rebuild-docker.sh
# script as kind of manual on how the drb_counter cointainer is managed and used
# throw errors if Gemfile has been modified since Gemfile.lock
RUN bundle config --global frozen 1
#RUN bundle config --global frozen 1
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
RUN apt-get update
RUN apt install -y build-essential
RUN gem install bundler:1.17.3
RUN mkdir -p /usr/src/app/config
# Test
#RUN apt-get update && apt-get install -y qt5-default libqt5webkit5-dev --no-install-recommends && rm -rf /var/lib/apt/lists/*
# Standard
@@ -15,14 +25,15 @@ RUN apt-get update
# Specific
#RUN apt-get update && apt-get install -y dos2unix --no-install-recommends && rm -rf /var/lib/apt/lists/*
COPY Gemfile /usr/src/app/
COPY Gemfile.lock /usr/src/app/
COPY faye/Gemfile /usr/src/app/
#COPY faye/Gemfile.lock /usr/src/app/
#COPY vendor/cache /usr/src/app/vendor/cache
#RUN bundle install --local
RUN rm -rf /usr/src/app/.bundle
#RUN rm -rf /usr/src/app/.bundle
RUN bundle install
COPY . /usr/src/app
COPY ./faye /usr/src/app
ENV FAYE_PORT=9296
EXPOSE $FAYE_PORT
CMD thin start -R config.ru -p $FAYE_PORT
+22 -2
View File
@@ -1,7 +1,27 @@
require 'faye'
require 'pry'
#require 'pry'
# started using (with extra server contexts of cours like full paths):
# thin start -d -R faye/config.ru -p 9296 --pid tmp/pids/faye.pid
# serve nginx config:
# server {
# listen 443 ssl http2;
# listen [::]:443 ssl http2;
#
# server_name events.mozo.bar;
#
# ssl_certificate /etc/letsencrypt/live/mozo.bar/fullchain.pem;
# ssl_certificate_key /etc/letsencrypt/live/mozo.bar/privkey.pem;
# location / {
# proxy_pass http://127.0.0.1:9296;
# proxy_set_header Host $host;
# proxy_set_header X-Real-IP $remote_addr;
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# proxy_set_header X-Forwarded-Proto https;
# }
# }
#
#require File.expand_path('../config/initializers/faye_token.rb', __FILE__)
setproctitle('mozo_faye') if respond_to?(:setproctitle)
Process.setproctitle('mozo_faye') if Process.respond_to?(:setproctitle)
VALID_TOKENS = ['6be65f9b5e7d21b8ca8de4ccfad5ba24cf40d440b370af79']
class ServerAuth
def incoming(message, callback)
+26
View File
@@ -0,0 +1,26 @@
#!/usr/bin/env bash
# This script rebuilds the whole environment and starts a new container
# 1. ensure this script is run from the project's root, not the faye directory
pwd_dirname=$(basename $(pwd));
script_dirname="faye";
if [ "$pwd_dirname" == "$script_dirname" ]; then
echo "PWD DIRNAME: "$pwd_dirname;
echo "You must run this script from the project's root dir (../) for the Dockerfile to have access to the configs to COPY";
exit 1;
fi
# 2. stop and remove all running/existing containers
docker rm $(docker stop $(docker ps -a -q --filter ancestor=mozo_faye))
# 3. remove the previously built images
docker rmi mozo_faye
# 4. rebuild a fresh image from the latest code
docker build -f faye/Dockerfile -t mozo_faye .
# debug docker and enter the bash:
# docker run --network=host --env DRB_ENV=production -t -i --rm mozo_faye bash
# 5. Spin up the counter container from the generated image
docker run --network=host --env DRB_ENV=production --detach --name=mozo_faye mozo_faye