Skip to content
This repository has been archived by the owner on Feb 2, 2018. It is now read-only.

Showcase provisioning #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# Configuring the shared folders
machine.vm.synced_folder Dir.pwd + "/../groupeat-api", "/home/vagrant/api/current", nfs: true
machine.vm.synced_folder Dir.pwd + "/../groupeat-frontend", "/home/vagrant/frontend", nfs: true
machine.vm.synced_folder Dir.pwd + "/../groupeat-showcase", "/home/vagrant/showcase", nfs: true

# Configuring the VM IP on the local private network
machine.vm.network "private_network", ip: "192.168.10.10"
Expand Down
3 changes: 3 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,12 @@ Since the API needs a lot of Composer dependencies, you need a token from GitHub
- Clone the API and frontend repositories with the commands:
- `git clone [email protected]:GroupEat/groupeat-api.git ../groupeat-api`
- `git clone [email protected]:GroupEat/groupeat-frontend.git ../groupeat-frontend`
- `git clone [email protected]:GroupEat/groupeat-showcase.git ../groupeat-showcase`
- Fill the missing data if any in `../groupeat-api/example.env` and copy this file to `../groupeat-api/.env`.
- Add `192.168.10.10 groupeat.dev` to your hosts file.
- Run the `vagrant box update` and `vagrant up` commands and wait for them to finish (a few minutes depending on your internet connection).
- In the `groupeat-frontend` directory, install the dependencies with `npm install` and build with `gulp build`.
- In the `groupeat-showcase` directory, install the dependencies with `npm install`, `bower install` and build with `gulp release`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use local version of bower through the postinstall hook pls

- Browse to http://groupeat.dev and make sure it works.

# Updating
Expand All @@ -46,6 +48,7 @@ Since the API needs a lot of Composer dependencies, you need a token from GitHub

- API: every bash command should be executed inside the VM. For that SSH into it with the `vagrant ssh` command.
- Frontend: every bash command should be executed on the host machine (ie. directly on your OS). This is because the `gulp watch` task and Livereload do not play nicely with Vagrant.
- Showcase: every bash command should be executed on the host machine (ie. directly on your OS). This is because the `gulp dev` task and Livereload do not play nicely with Vagrant.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not needed as you use webpack dev server and not livereload


## Administration zone

Expand Down
6 changes: 6 additions & 0 deletions rebuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ cd ../groupeat-frontend
npm install
gulp build

echo "Building the showcase"
cd ../groupeat-showcase
npm install
bower install
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done by npm install

gulp release

echo "Cd into project root"
cd $projectRoot

Expand Down
9 changes: 9 additions & 0 deletions tasks/setup_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,12 @@
when: frontend.stat.exists == false
local_action: shell cd ../groupeat-frontend; gulp deploy --{{ deploy_connection }}
sudo: false

- name: Check if showcase is already deployed
stat: path=~vagrant/showcase
register: showcase

- name: Deploy showcase
when: showcase.stat.exists == false
local_action: shell cd ../groupeat-showcase; gulp deploy --{{ deploy_connection }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this won't work, the deploy task of frontend use rsync to copy the dist folder to the server corresponding to deploy_connection. You need to add an equivalent task by using rsync or shipit if you prefer.

sudo: false
7 changes: 6 additions & 1 deletion templates/groupeat.dev.nginx.conf.j2
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
server {
listen 80;
server_name groupeat.dev;
root /home/vagrant/frontend/dist;
root /home/vagrant/showcase/build;

charset utf-8;

location / {
try_files $uri /index.html;
}

location /app/ {
alias /home/vagrant/frontend/dist;
try_files $uri /index.html;
}

location /api/ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
Expand Down
7 changes: 6 additions & 1 deletion templates/groupeat.fr.nginx.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,19 @@ server {
server {
listen 443 ssl spdy default deferred;
server_name groupeat.fr;
root /home/vagrant/frontend/dist;
root /home/vagrant/showcase/build;
index index.html index.php;
charset utf-8;

location / {
try_files $uri /index.html;
}

location /app/ {
alias /home/vagrant/frontend/dist;
try_files $uri /index.html;
}

location /api/ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
Expand Down
7 changes: 6 additions & 1 deletion templates/staging.groupeat.fr.nginx.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,19 @@ server {
listen 80;
server_name staging.groupeat.fr;

root /home/vagrant/frontend/dist;
root /home/vagrant/showcase/build;
index index.html index.php;
charset utf-8;

location / {
try_files $uri /index.html;
}

location /app/ {
alias /home/vagrant/frontend/dist;
try_files $uri /index.html;
}

location /api/ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
Expand Down
7 changes: 7 additions & 0 deletions unix_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ else
git clone [email protected]:GroupEat/groupeat-frontend.git ../groupeat-frontend
fi

if [ -d ../groupeat-showcase ]; then
echo "GroupEat showcase repository already exists"
else
echo "Cloning GroupEat showcase repository"
git clone [email protected]:GroupEat/groupeat-showcase.git ../groupeat-showcase
fi

echo "Cd into groupeat-api"
cd ../groupeat-api

Expand Down
3 changes: 3 additions & 0 deletions update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ cd ../groupeat-api; git pull;
echo "Pulling changes from groupeat-frontend"
cd ../groupeat-frontend; git pull;

echo "Pulling changes from groupeat-showcase"
cd ../groupeat-showcase; git pull;

echo "Cd into project root"
cd $projectRoot

Expand Down