From f10d342c5b5cff6d11a8d532c53428784fc96a2e Mon Sep 17 00:00:00 2001 From: guange Date: Wed, 11 Dec 2019 12:17:01 +0800 Subject: [PATCH] . --- .gitignore | 11 ++++++++ app/controllers/jupyters_controller.rb | 6 ++++- bin/bundle | 6 ++--- bin/rails | 8 +++--- bin/rake | 10 +++++--- docker-compose.yml | 35 ++++++++++++++++++++++++++ 6 files changed, 64 insertions(+), 12 deletions(-) create mode 100644 docker-compose.yml diff --git a/.gitignore b/.gitignore index ea08c700e..12dc596a6 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ # Ignore bundler config. /.bundle +/bundle # Ignore lock config file *.lock @@ -70,3 +71,13 @@ vendor/bundle/ /workspace /log /public/admin +/mysql_data + + +.generators +.rakeTasks +db/bak/ +docker/ +educoder.sql +redis_data/ +Dockerfile \ No newline at end of file diff --git a/app/controllers/jupyters_controller.rb b/app/controllers/jupyters_controller.rb index cd99b501e..9e137946f 100644 --- a/app/controllers/jupyters_controller.rb +++ b/app/controllers/jupyters_controller.rb @@ -56,6 +56,8 @@ class JupytersController < ApplicationController author_email = current_user.git_mail message = "User submitted" + + #https://47526.jupyter.educoder.net/nbconvert/notebook/data/workspace/myshixun_570461/f2ef5p798r20191210163135/01.ipynb?download=true src_url = URI("https://47519.jupyter.educoder.net/nbconvert/notebook/data/workspace/myshixun_tpm3575/01.ipynb?download=true") response = Net::HTTP.get_response(src_url) @@ -73,10 +75,12 @@ class JupytersController < ApplicationController author_email: author_email) render plain: 'save: #{c.size}' - end + + + private def shixun @shixun = Shixun.find(3575) diff --git a/bin/bundle b/bin/bundle index b48d3a0d5..f19acf5b5 100644 --- a/bin/bundle +++ b/bin/bundle @@ -1,3 +1,3 @@ -#!/usr/bin/env ruby -ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) -load Gem.bin_path('bundler', 'bundle') +#!/usr/bin/env ruby +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) +load Gem.bin_path('bundler', 'bundle') diff --git a/bin/rails b/bin/rails index a017658c5..073966023 100644 --- a/bin/rails +++ b/bin/rails @@ -1,4 +1,4 @@ -#!/usr/bin/env ruby -APP_PATH = File.expand_path('../config/application', __dir__) -require_relative '../config/boot' -require 'rails/commands' +#!/usr/bin/env ruby +APP_PATH = File.expand_path('../config/application', __dir__) +require_relative '../config/boot' +require 'rails/commands' diff --git a/bin/rake b/bin/rake index 8704afdf3..2c877f116 100644 --- a/bin/rake +++ b/bin/rake @@ -1,4 +1,6 @@ -#!/usr/bin/env ruby -require_relative '../config/boot' -require 'rake' -Rake.application.run +#!/usr/bin/env ruby +require_relative '../config/boot' + + +require 'rake' +Rake.application.run diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 000000000..16f600df4 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,35 @@ +version: '3' +services: + mysql: + image: mysql:5.7.17 + command: --sql-mode="" + restart: always + volumes: + - ./mysql_data/:/var/lib/mysql + ports: + - "3306:3306" + environment: + MYSQL_ROOT_PASSWORD: 123456789 + MYSQL_DATABASE: educoder + + redis: + image: redis:3.2 + container_name: redis + restart: always + ports: + - "6379:6379" + volumes: + - ./redis_data:/data + + web: + image: guange/educoder:latest + command: bash -c "rm -f tmp/pids/server.pid && bundle exec rails s -p 4000 -b '0.0.0.0'" + stdin_open: true + tty: true + volumes: + - .:/app + ports: + - "4000:4000" + depends_on: + - mysql + - redis \ No newline at end of file