From 1318a84138a91c891116d587e5abae956dc69a3c Mon Sep 17 00:00:00 2001 From: Rui Oliveira <70754369+ruioliveira02@users.noreply.github.com> Date: Wed, 2 Mar 2022 19:29:27 +0000 Subject: [PATCH 1/4] Added Vagrantfile (#1) * Added configuration for vagrant box * Updated documentation for new build process * Add bootstrap to setup process * Add virtualbox reference Co-authored-by: Rui Oliveira --- .env.example | 6 ++--- Vagrantfile | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++ bootstrap.sh | 13 ++++++++++ readme.md | 41 ++++++++++++++++++++---------- 4 files changed, 116 insertions(+), 16 deletions(-) create mode 100644 Vagrantfile create mode 100644 bootstrap.sh mode change 100644 => 100755 readme.md diff --git a/.env.example b/.env.example index d44ec8d..9baebde 100644 --- a/.env.example +++ b/.env.example @@ -8,9 +8,9 @@ APP_URL=http://localhost DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 -DB_DATABASE=homestead -DB_USERNAME=homestead -DB_PASSWORD=secret +DB_DATABASE=swap +DB_USERNAME=root +DB_PASSWORD=swap BROADCAST_DRIVER=log CACHE_DRIVER=file diff --git a/Vagrantfile b/Vagrantfile new file mode 100644 index 0000000..a94de4d --- /dev/null +++ b/Vagrantfile @@ -0,0 +1,72 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +# All Vagrant configuration is done below. The "2" in Vagrant.configure +# configures the configuration version (we support older styles for +# backwards compatibility). Please don't change it unless you know what +# you're doing. +Vagrant.configure("2") do |config| + # The most common configuration options are documented and commented below. + # For a complete reference, please see the online documentation at + # https://docs.vagrantup.com. + + # Every Vagrant development environment requires a box. You can search for + # boxes at https://vagrantcloud.com/search. + config.vm.box = "ubuntu/focal64" + config.vm.provision :shell, path: "bootstrap.sh" + config.vm.network "private_network", ip: "192.168.56.21" + config.vm.synced_folder "./", "/vagrant", type: "rsync", rsync__auto: true, rsync__exclude: ['./node_modules*'] + # Disable automatic box update checking. If you disable this, then + # boxes will only be checked for updates when the user runs + # `vagrant box outdated`. This is not recommended. + # config.vm.box_check_update = false + + # Create a forwarded port mapping which allows access to a specific port + # within the machine from a port on the host machine. In the example below, + # accessing "localhost:8080" will access port 80 on the guest machine. + # NOTE: This will enable public access to the opened port + # config.vm.network "forwarded_port", guest: 80, host: 8080 + + # Create a forwarded port mapping which allows access to a specific port + # within the machine from a port on the host machine and only allow access + # via 127.0.0.1 to disable public access + # config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1" + + # Create a private network, which allows host-only access to the machine + # using a specific IP. + # config.vm.network "private_network", ip: "192.168.33.10" + + # Create a public network, which generally matched to bridged network. + # Bridged networks make the machine appear as another physical device on + # your network. + # config.vm.network "public_network" + + # Share an additional folder to the guest VM. The first argument is + # the path on the host to the actual folder. The second argument is + # the path on the guest to mount the folder. And the optional third + # argument is a set of non-required options. + # config.vm.synced_folder "../data", "/vagrant_data" + + # Provider-specific configuration so you can fine-tune various + # backing providers for Vagrant. These expose provider-specific options. + # Example for VirtualBox: + # + # config.vm.provider "virtualbox" do |vb| + # # Display the VirtualBox GUI when booting the machine + # vb.gui = true + # + # # Customize the amount of memory on the VM: + # vb.memory = "1024" + # end + # + # View the documentation for the provider you are using for more + # information on available options. + + # Enable provisioning with a shell script. Additional provisioners such as + # Ansible, Chef, Docker, Puppet and Salt are also available. Please see the + # documentation for more information about their specific syntax and use. + # config.vm.provision "shell", inline: <<-SHELL + # apt-get update + # apt-get install -y apache2 + # SHELL +end diff --git a/bootstrap.sh b/bootstrap.sh new file mode 100644 index 0000000..255c37a --- /dev/null +++ b/bootstrap.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +apt-get update +apt-get install -y php7.4-mysql php7.4-xml php7.4-gd php7.4-mbstring php7.4-zip mysql-server composer npm +cd /vagrant +rm package-lock.json +mysql -u root -p -e 'CREATE DATABASE swap;' +mysql -u root -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'swap';" +composer install +php artisan key:generate +php artisan migrate +php artisan db:seed + diff --git a/readme.md b/readme.md old mode 100644 new mode 100755 index cdc5fff..106b3a4 --- a/readme.md +++ b/readme.md @@ -21,10 +21,11 @@ This project was developed with the Board of Directors of the University of Minh ## Requirements - [PHP](http://php.net/) 7.4+ -- PostgreSQL database +- [MySQL](https://www.mysql.com/) - Database Management System - [Composer](https://getcomposer.org/) - Installs package dependencies - [NodeJS](https://nodejs.org/en/) - Provides NPM to install node packages -- [Yarn](https://yarnpkg.com/lang/en/) - Provides a fast, reliable and secure node package manager. +- [Vagrant](https://vagrantup.com) - Provides a fast, reliable and secure node package manager. +- [VirtualBox](https://www.virtualbox.org/) - Virtual machine provider for Vagrant ## Installation @@ -32,32 +33,46 @@ This project was developed with the Board of Directors of the University of Minh - Rename `.env.example` to `.env` and fill the options > **Note**: This project sends e-mails. Therefore, ensure that the e-mail driver is specified. -- Install project dependencies: +### Setting up Vagrant + +- To configure the Vagrant VM run ``` -composer install -yarn install +vagrant up +vagrant ssh ``` -- Generate application key: +- In the VM run ``` -php artisan key:generate +cd /vagrant +bash bootstrap.sh ``` -- Migrate and seed the database: +> **Note**: If the prespecified IP in ```Vagrantfile``` is already in use, you need to change it before running ```vagrant up``` + +- Install node packages (in host machine) ``` -php artisan migrate -php artisan db:seed +npm install ``` -- Build assets (e.g. in development environment) + +## Building and running + +- Build assets (in your host machine) ``` npm run dev ``` -- Start local server +- SSH into the VM +``` +vagrant ssh +``` + +- Start the server ``` -php artisan serve +cd /vagrant +php artisan serve --host=0.0.0.0 # We specifiy the host IP to be able to access server outside VM ``` +- In your browser, open http://192.168.56.21:8000 ## License The Swap project is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT). From a791f08b27d99d4ea8d72f40d15f04f03df2bf07 Mon Sep 17 00:00:00 2001 From: Rui Ribeiro Date: Mon, 28 Mar 2022 15:53:45 +0100 Subject: [PATCH 2/4] Prepare UI for new exchanges (#2) * Adapt exchanges table to new format * Tweak style of exchanges table --- public/images/switch-vertical.svg | 3 +++ resources/assets/js/components/modals/DeleteExchangeModal.vue | 4 ++-- resources/assets/sass/_table.sass | 4 ++++ resources/views/dashboard.blade.php | 4 ++-- resources/views/exchanges/dashboard/requested/show.blade.php | 3 ++- 5 files changed, 13 insertions(+), 5 deletions(-) create mode 100644 public/images/switch-vertical.svg diff --git a/public/images/switch-vertical.svg b/public/images/switch-vertical.svg new file mode 100644 index 0000000..4189537 --- /dev/null +++ b/public/images/switch-vertical.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/resources/assets/js/components/modals/DeleteExchangeModal.vue b/resources/assets/js/components/modals/DeleteExchangeModal.vue index d520b60..8203dca 100644 --- a/resources/assets/js/components/modals/DeleteExchangeModal.vue +++ b/resources/assets/js/components/modals/DeleteExchangeModal.vue @@ -1,8 +1,8 @@