diff --git a/Vagrantfile b/Vagrantfile deleted file mode 100644 index a5b1879e..00000000 --- a/Vagrantfile +++ /dev/null @@ -1,18 +0,0 @@ -Vagrant.configure('2') do |config| - config.hostmanager.enabled = true - config.hostmanager.manage_host = true - - config.vm.box = 'debian/buster64' - config.vm.provider 'virtualbox' do |v| - v.cpus = 2 - v.memory = 1280 - end - - config.vm.define 'default' do |node| - node.vm.hostname = 'philomena.lc' - node.vm.network :private_network, ip: '192.168.64.79' - end - - config.vm.synced_folder '.', '/vagrant', type: 'virtualbox' - config.vm.provision 'shell', path: 'vagrant/install.bash' -end diff --git a/vagrant/app_setup.bash b/vagrant/app_setup.bash deleted file mode 100644 index 55cc56f3..00000000 --- a/vagrant/app_setup.bash +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/env bash - -# Install Hex and Phoenix -mix local.hex --force -mix local.rebar --force -mix archive.install hex phx_new 1.4.3 --force - -# Enter app dir -cd $1 - -# Install dependencies -mix deps.get -mix deps.compile - -# Set up database -mix ecto.setup --force - -# Install modules -(cd assets; npm install) diff --git a/vagrant/install.bash b/vagrant/install.bash deleted file mode 100644 index 3d9a4f85..00000000 --- a/vagrant/install.bash +++ /dev/null @@ -1,96 +0,0 @@ -#!/usr/bin/env bash - -APP_USER=vagrant -APP_DIR="/home/$APP_USER/philomena" - -echo "debconf debconf/frontend select noninteractive" | sudo debconf-set-selections -sed -i -e 's/\(AcceptEnv LANG LC_\*\)/#\1/' /etc/ssh/sshd_config -service sshd restart - -add_key() { - wget -qO - "$1" | apt-key add - &>/dev/null -} - -install_packages() { - apt-get install -y $@ -} - -# Vagrant setup, if necessary -if [ -e /vagrant ]; then - ln -s /vagrant "$APP_DIR" - chown -R "$APP_USER:$APP_USER" "/home/$APP_USER" -fi - -# Necessary for apt and elasticsearch to succeed -install_packages apt-transport-https default-jre-headless - -if [ ! -f /etc/apt/sources.list.d/elasticsearch-6.x.list ]; then - add_key https://packages.elastic.co/GPG-KEY-elasticsearch - echo "deb https://artifacts.elastic.co/packages/6.x/apt stable main" > /etc/apt/sources.list.d/elasticsearch-6.x.list -fi - -if [ ! -f /etc/apt/sources.list.d/pgdg.list ]; then - add_key https://www.postgresql.org/media/keys/ACCC4CF8.asc - echo "deb http://apt.postgresql.org/pub/repos/apt/ buster-pgdg main" > /etc/apt/sources.list.d/pgdg.list -fi - -if [ ! -f /etc/apt/sources.list.d/nginx.list ]; then - add_key http://nginx.org/keys/nginx_signing.key - echo "deb http://nginx.org/packages/debian/ buster nginx" > /etc/apt/sources.list.d/nginx.list -fi - -if [ ! -f /etc/apt/sources.list.d/nodesource.list ]; then - add_key https://deb.nodesource.com/gpgkey/nodesource.gpg.key - echo 'deb https://deb.nodesource.com/node_12.x buster main' > /etc/apt/sources.list.d/nodesource.list -fi - -if [ ! -f /etc/apt/sources.list.d/erlang.list ]; then - add_key https://packages.erlang-solutions.com/debian/erlang_solutions.asc - echo 'deb http://binaries.erlang-solutions.com/debian buster contrib' > /etc/apt/sources.list.d/erlang.list -fi - -apt-get update - -if ! install_packages build-essential postgresql-11 libpq-dev nginx nodejs \ - elasticsearch esl-erlang elixir inotify-tools git \ - redis-server automake libtool zlib1g-dev ffmpeg \ - libavutil-dev libavcodec-dev libavformat-dev \ - libmagic-dev libpng-dev gifsicle optipng libjpeg-progs; then - >&2 echo "Installation of dependencies failed." - exit 1 -fi - -if [ ! -f /usr/local/bin/image-intensities ]; then - pushd . - cd /tmp - git clone https://github.com/derpibooru/cli_intensities - cd cli_intensities - make install - popd -fi - -if [ ! -f /usr/local/bin/safe-rsvg-convert ]; then - # passing input on stdin prevents the loading of any - # external resources - echo ' -#!/bin/sh -rsvg-convert < "$1" -o "$2" - ' > /usr/local/bin/safe-rsvg-convert - chmod +x /usr/local/bin/safe-rsvg-convert -fi - -sed -i -e 's/\(-Xm[sx]\)1g/\1256m/' /etc/elasticsearch/jvm.options -systemctl enable elasticsearch 2>/dev/null -service elasticsearch start - -sed -i -e 's/md5/trust/' /etc/postgresql/11/main/pg_hba.conf -service postgresql restart - -sudo -u postgres createuser -s "$APP_USER" - -# nginx configuration -cp "$APP_DIR/vagrant/philomena-nginx.conf" /etc/nginx/conf.d/default.conf -sed -i -e "s|APP_DIR|$APP_DIR|g" /etc/nginx/conf.d/default.conf -service nginx restart - -sudo -u "$APP_USER" bash "$APP_DIR/vagrant/app_setup.bash" "$APP_DIR" diff --git a/vagrant/philomena-nginx.conf b/vagrant/philomena-nginx.conf deleted file mode 100644 index 54f9ffcb..00000000 --- a/vagrant/philomena-nginx.conf +++ /dev/null @@ -1,76 +0,0 @@ -upstream philomena { - server localhost:4000 fail_timeout=0; -} - -server { - listen 80 default; - listen [::]:80; - - root APP_DIR/priv/static; - - location ~ ^/img/view/(.+)/([0-9]+).*\.([A-Za-z]+)$ { - expires max; - add_header Cache-Control public; - alias "APP_DIR/priv/static/system/images/thumbs/$1/$2/full.$3"; - } - - location ~ ^/img/download/(.+)/([0-9]+).*\.([A-Za-z]+)$ { - add_header Content-Disposition "attachment"; - expires max; - add_header Cache-Control public; - alias "APP_DIR/priv/static/system/images/thumbs/$1/$2/full.$3"; - } - - location ~ ^/img/(.+) { - expires max; - add_header Cache-Control public; - alias APP_DIR/priv/static/system/images/thumbs/$1; - } - - location ~ ^/spns/(.+) { - expires max; - add_header Cache-Control public; - alias APP_DIR/priv/static/system/images/adverts/$1; - } - - location ~ ^/avatars/(.+) { - expires max; - add_header Cache-Control public; - alias APP_DIR/priv/static/system/images/avatars/$1; - } - - location ~ ^/media/(.+) { - expires max; - add_header Cache-Control public; - alias APP_DIR/priv/static/system/images/$1; - } - - location / { - try_files $uri @proxy; - } - - location @proxy { - proxy_pass http://philomena; - proxy_redirect off; - - proxy_set_header Host $host:$server_port; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - - client_max_body_size 30m; - client_body_buffer_size 128k; - - proxy_connect_timeout 90; - proxy_send_timeout 90; - proxy_read_timeout 90; - - proxy_buffer_size 4k; - proxy_buffers 4 32k; - proxy_busy_buffers_size 64k; - proxy_temp_file_write_size 64k; - - # Configuration for Phoenix WS - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection "upgrade"; - } -}