Alexis Hernandez
6 years ago
4 changed files with 132 additions and 0 deletions
@ -0,0 +1,34 @@ |
|||
server { |
|||
listen 80 default_server; |
|||
|
|||
root /var/www/html; |
|||
|
|||
index index.html; |
|||
|
|||
server_name xsnexplorer.io; |
|||
|
|||
# the backend api |
|||
location /api/ltc { |
|||
rewrite ^/api/ltc/(.*) /$1 break; |
|||
proxy_pass http://18.222.26.185:9000; |
|||
} |
|||
|
|||
location /api/xsn { |
|||
rewrite ^/api/xsn/(.*) /$1 break; |
|||
proxy_pass http://18.224.5.222:9000; |
|||
} |
|||
|
|||
location /api { |
|||
rewrite ^/api/(.*) /$1 break; |
|||
proxy_pass http://18.224.5.222:9000; |
|||
} |
|||
|
|||
# caching static assets |
|||
location ~* \.(jpg|jpeg|png|gif|ico|css|js)$ { |
|||
expires 7d; |
|||
} |
|||
|
|||
location / { |
|||
try_files $uri $uri/ /index.html; |
|||
} |
|||
} |
@ -0,0 +1,92 @@ |
|||
--- |
|||
- hosts: frontend |
|||
gather_facts: no |
|||
roles: |
|||
- ubuntu-16-04 |
|||
|
|||
tasks: |
|||
- name: Install nginx |
|||
become: yes |
|||
apt: |
|||
name: nginx |
|||
state: latest |
|||
update_cache: yes |
|||
|
|||
- name: Disable nginx default site |
|||
become: yes |
|||
file: |
|||
path: /etc/nginx/sites-enabled/default |
|||
state: absent |
|||
|
|||
- name: Remove nginx default site config |
|||
become: yes |
|||
file: |
|||
path: /etc/nginx/sites-available/default |
|||
state: absent |
|||
|
|||
- name: Create nginx log directory |
|||
become: yes |
|||
file: |
|||
path: /var/log/nginx |
|||
state: directory |
|||
|
|||
- name: Copy the nginx config |
|||
become: yes |
|||
copy: |
|||
src: config/xsnexplorer.io |
|||
dest: /etc/nginx/sites-available/xsnexplorer |
|||
|
|||
- name: Create the symlink |
|||
become: yes |
|||
file: |
|||
src: /etc/nginx/sites-available/xsnexplorer |
|||
dest: /etc/nginx/sites-enabled/xsnexplorer |
|||
state: link |
|||
|
|||
- name: Restart nginx |
|||
become: yes |
|||
service: |
|||
name: nginx |
|||
state: restarted |
|||
|
|||
- name: Enable nginx to run on system startup |
|||
become: yes |
|||
systemd: |
|||
name: nginx |
|||
enabled: yes |
|||
|
|||
- name: Build the application |
|||
shell: ./scripts/build-web-ui.sh |
|||
delegate_to: 127.0.0.1 |
|||
|
|||
- name: Upload the application |
|||
synchronize: |
|||
src: web.zip |
|||
dest: web.zip |
|||
|
|||
- name: Create the web data directory |
|||
become: yes |
|||
file: |
|||
path: /var/www/html |
|||
state: directory |
|||
owner: www-data |
|||
group: www-data |
|||
|
|||
- name: Unpack the application |
|||
become: yes |
|||
unarchive: |
|||
remote_src: yes |
|||
src: web.zip |
|||
dest: /var/www/html |
|||
|
|||
- name: Move the web content |
|||
become: yes |
|||
raw: rsync -a /var/www/html/dist/ /var/www/html/ --remove-source-files |
|||
|
|||
- name: Set the permissions |
|||
become: yes |
|||
file: |
|||
dest: /var/www/html |
|||
owner: www-data |
|||
group: www-data |
|||
recurse: yes |
@ -0,0 +1,2 @@ |
|||
[frontend] |
|||
explorer-frontend |
@ -0,0 +1,4 @@ |
|||
#!/bin/bash |
|||
set -e |
|||
cd ../../web-ui/ && ng build --prod && zip -r web.zip dist/* && cd - |
|||
mv ../../web-ui/web.zip web.zip |
Loading…
Reference in new issue