base_image: "samsaffron/discourse_base_21:1.0" update_pups: false params: home: /var/www/logster templates: - "templates/redis.template.yml" - "templates/sshd.template.yml" expose: - "8081:80" - "2228:22" volumes: - volume: host: /var/docker/shared/logster guest: /shared hooks: after_redis: - exec: cmd: - useradd logster -s /bin/bash -m -U - exec: background: true cmd: "sudo -u redis /usr/bin/redis-server /etc/redis/redis.conf --dbfilename test.rdb" - exec: mkdir -p /var/www - exec: cd /var/www && git clone --depth 1 https://github.com/SamSaffron/logster.git - exec: cd: $home cmd: - chown -R logster $home - mkdir -p /shared/gems - chown -R logster /shared/gems - sudo -E -u logster bundle install --path=/shared/gems --verbose - sudo -E -u logster bundle exec rake - exec: cd: $home/website cmd: - sudo -E -u logster bundle install --path=/shared/gems --verbose - file: path: /etc/service/puma/run chmod: "+x" contents: | #!/bin/bash exec 2>&1 # redis cd $home/website exec sudo -E -u logster LD_PRELOAD=/usr/lib/libjemalloc.so.1 bundle exec puma -p 8080 -e production - exec: rm /etc/nginx/sites-enabled/default - replace: filename: /etc/nginx/nginx.conf from: pid /run/nginx.pid; to: daemon off; - file: path: /etc/nginx/conf.d/logster.conf contents: | upstream logster { server localhost:8080; } server { listen 80; gzip on; gzip_types application/json text/css application/x-javascript; gzip_min_length 1000; server_name logster.info; keepalive_timeout 65; location ~ ^/logs(?/[^\?]+).* { root /var/www/logster/assets; expires 1y; add_header ETag ""; add_header Cache-Control public; try_files $relative @logster; } location / { try_files $uri @logster; } location @logster { proxy_set_header Host $http_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 http; proxy_pass http://logster; } } - file: path: /etc/service/nginx/run chmod: "+x" contents: | #!/bin/sh exec 2>&1 exec /usr/sbin/nginx