diff --git a/.gitignore b/.gitignore index e495c7c3efa..1ba71b5f077 100644 --- a/.gitignore +++ b/.gitignore @@ -16,9 +16,6 @@ WcaOnRails/public/documents/* # byebug stuff .byebug_history -# Vagrant stuff -.vagrant/ - # phpBB mess webroot/forum/cache/* !webroot/forum/cache/.htaccess diff --git a/.overcommit.yml b/.overcommit.yml index b83d0a9c32b..f64cdaa8cb8 100644 --- a/.overcommit.yml +++ b/.overcommit.yml @@ -30,7 +30,6 @@ PreCommit: - 'WcaOnRails/config/locales/*.yml' - 'chef/**/*' - '.gitmodules' - - 'Vagrantfile' - '**/*.pdf' - '**/*.jpg' - '**/*.png' diff --git a/Vagrantfile b/Vagrantfile deleted file mode 100644 index cee96440534..00000000000 --- a/Vagrantfile +++ /dev/null @@ -1,20 +0,0 @@ -Vagrant.configure(2) do |config| - config.vm.box = "ubuntu/focal64" - config.vm.network :forwarded_port, host: 2331, guest: 2331 - # Mailcatcher runs on port 1080 inside the VM. - config.vm.network :forwarded_port, host: 2332, guest: 1080 - config.ssh.forward_agent = true - - config.vm.provider "virtualbox" do |vb| - # The results scripts can be a bit of a hog. - vb.memory = 2048 - end - - # A full development environment - config.vm.define "all", autostart: false do |all| - all.vm.provision "shell" do |s| - s.path = "scripts/wca-bootstrap.sh" - s.args = ["development"] - end - end -end diff --git a/WcaOnRails/app/uploaders/avatar_uploader_base.rb b/WcaOnRails/app/uploaders/avatar_uploader_base.rb index c5b026066b6..8f4b460ad40 100644 --- a/WcaOnRails/app/uploaders/avatar_uploader_base.rb +++ b/WcaOnRails/app/uploaders/avatar_uploader_base.rb @@ -127,16 +127,3 @@ def full_original_filename end end end - -if File.exist? "/vagrant" - # Workaround for Vagrant bug with sendfile. - # carrierwave uses FileUtils.cp to copy around files that it - # mutates with mogrify, which exposes this bug. - # See https://github.com/mitchellh/vagrant/issues/351. - module FileUtils - def cp(src, dest, **options) - `cp #{src.shellescape} #{dest.shellescape}` - end - module_function :cp - end -end diff --git a/chef/client.rb b/chef/client.rb deleted file mode 100644 index 0591b22227d..00000000000 --- a/chef/client.rb +++ /dev/null @@ -1 +0,0 @@ -cookbook_path ['/vagrant/chef/cookbooks', '/vagrant/chef/site-cookbooks'] diff --git a/chef/roles/wca.json b/chef/roles/wca.json index 83aef5d0724..f1fd1ed455c 100644 --- a/chef/roles/wca.json +++ b/chef/roles/wca.json @@ -6,7 +6,7 @@ "authorization": { "sudo": { "groups": ["admin", "sudo", "sysadmin"], - "users": ["vagrant", "cubing"], + "users": ["cubing"], "passwordless": "true" } }, diff --git a/chef/site-cookbooks/wca/chefignore b/chef/site-cookbooks/wca/chefignore index 80dc2d20ef5..5767c60dda1 100644 --- a/chef/site-cookbooks/wca/chefignore +++ b/chef/site-cookbooks/wca/chefignore @@ -85,11 +85,6 @@ Strainerfile .colander .strainer -# Vagrant # -########### -.vagrant -Vagrantfile - # Travis # ########## .travis.yml diff --git a/chef/site-cookbooks/wca/libraries/wca_helper.rb b/chef/site-cookbooks/wca/libraries/wca_helper.rb index bfa2f424cc1..d5d5e650412 100644 --- a/chef/site-cookbooks/wca/libraries/wca_helper.rb +++ b/chef/site-cookbooks/wca/libraries/wca_helper.rb @@ -1,13 +1,10 @@ module WcaHelper + # gregorbg: This method exists as a relic from a time when we needed to distinguish between "real" servers and Vagrant. + # Now that we're planning to get rid of Chef entirely, I didn't bother to properly refactor this. def self.get_username_and_repo_root(recipe) - vagrant_user = recipe.node['etc']['passwd']['vagrant'] - if vagrant_user - username = "vagrant" - repo_root = "/vagrant" - else - username = "cubing" - repo_root = "/home/#{username}/worldcubeassociation.org" - end + username = "cubing" + repo_root = "/home/#{username}/worldcubeassociation.org" + return [ username, repo_root ] end diff --git a/chef/site-cookbooks/wca/templates/rc.local.erb b/chef/site-cookbooks/wca/templates/rc.local.erb index 5e743186075..d6a9b238d70 100644 --- a/chef/site-cookbooks/wca/templates/rc.local.erb +++ b/chef/site-cookbooks/wca/templates/rc.local.erb @@ -1,7 +1,5 @@ #!/bin/sh -e -# sleep as a hack to wait for vagrant to mount the /vagrant directory, which is -# needed for our screen session -sudo su <%= @username %> -c 'sleep 10; ~/startall'& +sudo su <%= @username %> -c '~/startall'& exit 0 diff --git a/chef/site-cookbooks/wca/templates/worldcubeassociation.org.conf.erb b/chef/site-cookbooks/wca/templates/worldcubeassociation.org.conf.erb index 3ea1e63cb35..3623b4c5a69 100644 --- a/chef/site-cookbooks/wca/templates/worldcubeassociation.org.conf.erb +++ b/chef/site-cookbooks/wca/templates/worldcubeassociation.org.conf.erb @@ -25,18 +25,8 @@ upstream app { server { server_name <%= @server_name %> localhost; -<% if @rails_env == "development" %> - # Using sendfile isn't reliable in VirtualBox. See: - # http://wiki.nginx.org/Pitfalls#VirtualBox - sendfile off; - # In development, we're running behind Vagrant's proxy (host port 2331). - # If we run nginx on a different port (say 80), then when nginx sends redirects, - # they will be to port 80, which doesn't work from outside the vm. - listen 2331; - <% else %> # SSL is handled by the AWS Load Balancer and is only reachable through it listen 80; -<% end %> # Deny access to dotfiles and dotfolders. location ~ /\. { diff --git a/docker-compose.php.yml b/docker-compose.php.yml index e8a61fcd8c1..9fde15df5ca 100644 --- a/docker-compose.php.yml +++ b/docker-compose.php.yml @@ -4,28 +4,28 @@ services: image: nginx ports: - "8080:8080" - volumes: - - ./webroot:/webroot #PHP stuff - - ./WcaOnRails/app/views/regulations:/regulations #static regulations files - - ./WcaOnRails/public:/public #other static files - - ./docker/nginx-dev.conf:/etc/nginx/conf.d/default.conf - - ./docker/fcgi.conf:/etc/nginx/fcgi.conf - networks: - - wca-main - depends_on: - - php - - wca_on_rails + volumes: + - ./webroot:/webroot #PHP stuff + - ./WcaOnRails/app/views/regulations:/regulations #static regulations files + - ./WcaOnRails/public:/public #other static files + - ./docker/nginx-dev.conf:/etc/nginx/conf.d/default.conf + - ./docker/fcgi.conf:/etc/nginx/fcgi.conf + networks: + - wca-main + depends_on: + - php + - wca_on_rails -php: - build: - dockerfile: './docker/php-dockerfile' + php: + build: + dockerfile: './docker/php-dockerfile' volumes: - ./webroot:/webroot - ./secrets/uploads:/secrets/uploads # so we can pretend to upload stuff - networks: - - wca-main - environment: - - MYSQL_HOST=wca_db - - MYSQL_USER=root - - MYSQL_PASSWORD= - - MYSQL_DB=wca_development + networks: + - wca-main + environment: + - MYSQL_HOST=wca_db + - MYSQL_USER=root + - MYSQL_PASSWORD= + - MYSQL_DB=wca_development diff --git a/docker/php-dockerfile b/docker/php-dockerfile index 1f7df7e8ddc..23fe87d11c1 100644 --- a/docker/php-dockerfile +++ b/docker/php-dockerfile @@ -1,6 +1,12 @@ -FROM php:5.6.14-fpm +# Targeting 5.6 instead of a specific version is consistent with our current Chef setup +# which in turn targets "php5.6-*" packages in the ondrej repo. +FROM php:5.6-fpm EXPOSE 9000 COPY './docker/php-fpm.conf' "/usr/local/etc/php-fpm.conf" COPY './docker/php.ini' "/usr/local/etc/php/php.ini" COPY './docker/php-mysqli.ini' "/usr/local/etc/php/conf.d/docker-php-ext-mysqli.ini" -RUN docker-php-ext-install mysqli mbstring pdo pdo_mysql +RUN docker-php-ext-install mysql mysqli mbstring pdo pdo_mysql +# configure mysql bindings to use mysqlnd service, which is consistent with our current Chef setup +RUN docker-php-ext-configure pdo_mysql --with-pdo-mysql=mysqlnd +RUN docker-php-ext-configure mysql --with-pdo-mysql=mysqlnd +RUN docker-php-ext-configure mysqli --with-pdo-mysql=mysqlnd