This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| AWSTemplateFormatVersion: '2010-09-09' | |
| Transform: AWS::Serverless-2016-10-31 | |
| Description: > | |
| sam-api | |
| Sample SAM Template for sam-api | |
| # More info about Globals: https://github.com/awslabs/serverless-application-model/blob/master/docs/globals.rst | |
| Globals: | |
| Function: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 1.Upstream used to define groups of servers, in this case the rails app, that can be referenced by the proxy_pass | |
| upstream rails_app { | |
| server app:3000; | |
| } | |
| # 2.Server part | |
| server { | |
| # 2.1.Listen to incoming connection on port 80 | |
| listen 80; | |
| listen [::]:80; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| version: '3' | |
| services: | |
| app: | |
| # 1.Repository URI for our app image | |
| image: XXXXXXXXXX.dkr.ecr.eu-west-1.amazonaws.com/ror-ecs-app | |
| build: | |
| context: . | |
| dockerfile: ./docker/app/Dockerfile | |
| web: | |
| # 2.Repository URI for our web image |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 1.Specify the compose file format; we're using the last one. | |
| # If you're curious, at https://docs.docker.com/compose/compose-file/compose-versioning/ | |
| # you can find an extensive description on the difference among versions | |
| version: '3' | |
| # 2.Specify the list of services that will be built. In our case, app (Ruby on Rails) and web (NGINX) | |
| services: | |
| app: | |
| build: | |
| # 2.1.Specify the root path | |
| context: . |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 1.Upstream used to define groups of servers, in this case the rails app, that can be referenced by the proxy_pass | |
| upstream rails_app { | |
| server app:3000; | |
| } | |
| # 2.Server part | |
| server { | |
| # 2.1.Listen to incoming connection on port 80 | |
| listen 80; | |
| listen [::]:80; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| envsubst '$RAILS_ROOT' < /tmp/app.conf > /etc/nginx/conf.d/default.conf | |
| nginx -g "daemon off;" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 1.Retrieve the nginx base image | |
| FROM nginx | |
| # 2.Install some dependencies | |
| RUN apt-get update -qq && apt-get -y install apache2-utils | |
| # 3.Set env variable where NGINX should look for project files | |
| ENV RAILS_ROOT /var/www/ror-ecs | |
| # 4.Set working directory |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 1.Retrieve the ruby image | |
| FROM ruby:2.4.1 | |
| # 2.Install basic required libs | |
| RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs | |
| # 3.Install bundler | |
| RUN gem install bundler --version "1.15.3" | |
| # 4.Set an environment variable for the Rails app root folder |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Rails.application.routes.draw do | |
| get 'welcome/index' | |
| # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html | |
| root 'welcome#index' | |
| end |