-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
infra: Add deployment scripts for the alerts-ui project
- Loading branch information
Showing
7 changed files
with
148 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
.vault | ||
app.zip | ||
*.retry | ||
web.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
--- | ||
- hosts: alerts-ui | ||
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/cryptocoinalerts.net | ||
dest: /etc/nginx/sites-available/cryptocoinalerts | ||
|
||
- name: Create the symlink | ||
become: yes | ||
file: | ||
src: /etc/nginx/sites-available/cryptocoinalerts | ||
dest: /etc/nginx/sites-enabled/cryptocoinalerts | ||
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-alerts-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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
server { | ||
listen 80 default_server; | ||
|
||
root /var/www/html; | ||
|
||
index index.html; | ||
|
||
server_name cryptocoinalerts.net; | ||
|
||
# the backend api | ||
location /api { | ||
rewrite ^/api/(.*) /$1 break; | ||
proxy_pass http://127.0.0.1:9000; | ||
} | ||
|
||
# caching static assets | ||
location ~* \.(jpg|jpeg|png|gif|ico|css|js)$ { | ||
expires 7d; | ||
} | ||
|
||
location / { | ||
try_files $uri $uri/ /index.html; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
set -e | ||
cd ../../alerts-ui/ && ng build --prod && zip -r web.zip dist/* && cd - | ||
mv ../../alerts-ui/web.zip web.zip |