diff --git a/.travis.yml b/.travis.yml index 4eaef2a4..be52c161 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,12 @@ language: node_js node_js: - - "8.11.1" \ No newline at end of file + - "8.11.1" + +services: + - docker + +before_install: + # eventually set up AWS stuff here + - docker-compose up -d + - docker ps -a + diff --git a/Dockerfile b/Dockerfile index 05076099..8ba98119 100644 --- a/Dockerfile +++ b/Dockerfile @@ -30,6 +30,7 @@ RUN npm install pm2 -g RUN npm install local-ssl-proxy COPY index.js ecosystem.json ./ COPY --from=build /usr/src/app/dist ./dist -RUN npm run ssl-proxy -#RUN npm run fetch-examples:prod +# for reg production CMD ["pm2-runtime", "ecosystem.json"] +# for testing ssl locally +# CMD npm run ssl-proxy && pm2-runtime ecosystem.json diff --git a/docker-compose.yml b/docker-compose.yml index 87d5fd93..203fa5c8 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,9 +6,11 @@ services: - dbdata:/data/db expose: - "27017" - # nginx: - # build: ./nginx - server: + nginx: + build: ./nginx + ports: + - '80:80' + app: build: context: . dockerfile: Dockerfile @@ -17,15 +19,14 @@ services: - .env environment: - MONGO_URL=mongodb://mongo:27017/p5js-web-editor - - API_URL=https://localhost/api - - PORT=80 + # - API_URL=https://localhost/api + # - PORT=80 volumes: - .:/opt/node/app - /opt/node/app/node_modules ports: - '8000:8000' - - '80:80' - - '443:443' + # - '443:443' depends_on: - mongo volumes: diff --git a/nginx/Dockerfile b/nginx/Dockerfile index 49d6b29a..cbe1e0b1 100644 --- a/nginx/Dockerfile +++ b/nginx/Dockerfile @@ -1,5 +1,3 @@ FROM nginx:1.13.12 -RUN mkdir -p /etc/nginx/sites-enabled -COPY nginx.conf /etc/nginx/nginx.conf -COPY alpha.editor.p5js.org.conf /etc/nginx/sites-enabled \ No newline at end of file +COPY alpha.editor.p5js.org.conf /etc/nginx/conf.d/default.conf \ No newline at end of file diff --git a/nginx/alpha.editor.p5js.org.conf b/nginx/alpha.editor.p5js.org.conf index f89e51bd..884d68bb 100644 --- a/nginx/alpha.editor.p5js.org.conf +++ b/nginx/alpha.editor.p5js.org.conf @@ -1,27 +1,27 @@ # HTTP - redirect all requests to HTTPS: server { listen 80; - server_name alpha.editor.p5js.org; + #server_name alpha.editor.p5js.org; location / { - proxy_pass http://127.0.0.1:8000; + proxy_pass http://app:8000; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; proxy_set_header Host $host; proxy_cache_bypass $http_upgrade; } - location ~* \/login(\/)* { - return 301 https://$host$request_uri; - } - location ~* \/signup(\/)* { - return 301 https://$host$request_uri; - } - location ~* \/reset-password(\/)* { - return 301 https://$host$request_uri; - } - location ~* "\/[a-zA-Z0-9._-]{1,20}\/account(\/)*" { - return 301 https://$host$request_uri; - } + # location ~* \/login(\/)* { + # return 301 https://$host$request_uri; + # } + # location ~* \/signup(\/)* { + # return 301 https://$host$request_uri; + # } + # location ~* \/reset-password(\/)* { + # return 301 https://$host$request_uri; + # } + # location ~* "\/[a-zA-Z0-9._-]{1,20}\/account(\/)*" { + # return 301 https://$host$request_uri; + # } } @@ -41,13 +41,13 @@ # } # } -server { - listen 80; - server_name editor.p5js.org; - location ~ ^/(.*) { - return 302 http://alpha.editor.p5js.org/$1; - } -} +# server { +# listen 80; +# server_name editor.p5js.org; +# location ~ ^/(.*) { +# return 302 http://alpha.editor.p5js.org/$1; +# } +# } # server { # listen 443; diff --git a/nginx/nginx.conf b/nginx/nginx.conf index b0ab9feb..7d128192 100644 --- a/nginx/nginx.conf +++ b/nginx/nginx.conf @@ -30,59 +30,59 @@ http { # Load modular configuration files from the /etc/nginx/conf.d directory. # See http://nginx.org/en/docs/ngx_core_module.html#include # for more information. - include /etc/nginx/conf.d/*.conf; + # include /etc/nginx/conf.d/*.conf; include /etc/nginx/sites-enabled/*.conf; - index index.html index.htm; + # index index.html index.htm; - server { - listen 80 default_server; - listen [::]:80 default_server; - server_name localhost; - root /usr/share/nginx/html; + # server { + # listen 80 default_server; + # listen [::]:80 default_server; + # server_name localhost; + # root /usr/share/nginx/html; - # Load configuration files for the default server block. - include /etc/nginx/default.d/*.conf; + # # Load configuration files for the default server block. + # include /etc/nginx/default.d/*.conf; - location / { - } + # location / { + # } - # redirect server error pages to the static page /40x.html - # - error_page 404 /404.html; - location = /40x.html { - } + # # redirect server error pages to the static page /40x.html + # # + # error_page 404 /404.html; + # location = /40x.html { + # } - # redirect server error pages to the static page /50x.html - # - error_page 500 502 503 504 /50x.html; - location = /50x.html { - } + # # redirect server error pages to the static page /50x.html + # # + # error_page 500 502 503 504 /50x.html; + # location = /50x.html { + # } - # proxy the PHP scripts to Apache listening on 127.0.0.1:80 - # - #location ~ \.php$ { - # proxy_pass http://127.0.0.1; - #} + # # proxy the PHP scripts to Apache listening on 127.0.0.1:80 + # # + # #location ~ \.php$ { + # # proxy_pass http://127.0.0.1; + # #} - # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 - # - #location ~ \.php$ { - # root html; - # fastcgi_pass 127.0.0.1:9000; - # fastcgi_index index.php; - # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; - # include fastcgi_params; - #} + # # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 + # # + # #location ~ \.php$ { + # # root html; + # # fastcgi_pass 127.0.0.1:9000; + # # fastcgi_index index.php; + # # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; + # # include fastcgi_params; + # #} - # deny access to .htaccess files, if Apache's document root - # concurs with nginx's one - # - #location ~ /\.ht { - # deny all; - #} - } + # # deny access to .htaccess files, if Apache's document root + # # concurs with nginx's one + # # + # #location ~ /\.ht { + # # deny all; + # #} + # } # Settings for a TLS enabled server.