aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjloup <jeanloup.jamet@gmail.com>2018-02-14 17:55:09 +0100
committerjloup <jeanloup.jamet@gmail.com>2018-02-14 17:55:09 +0100
commit3602fbf8412d69900d793a963c8e774f487f5e45 (patch)
treed01254931d1e8147e685c8cbe032c81ceb00be4c
parent7a9e5112eaaea58d55f181d3e5296e4ff839921c (diff)
downloadFront-3602fbf8412d69900d793a963c8e774f487f5e45.tar.gz
Front-3602fbf8412d69900d793a963c8e774f487f5e45.tar.zst
Front-3602fbf8412d69900d793a963c8e774f487f5e45.zip
update README.HEADv0.0.1master
-rw-r--r--README.md121
1 files changed, 120 insertions, 1 deletions
diff --git a/README.md b/README.md
index 84e6304..4c38943 100644
--- a/README.md
+++ b/README.md
@@ -1 +1,120 @@
1# Crypto 1# Cryptoportfolio app
2
3Back and front end for cryptoportfolio project.
4
5Server binaries and webapp files are shipped to Github. No need to install dev dependencies to deploy it. All you need is [ansible](http://docs.ansible.com/ansible/latest/intro_installation.html#installing-the-control-machine)
6
7- [Deploy](#deploy) : deploy server binaries and webapp archive to a server with ansible
8- [Server](#server) : server written in golang
9- [Webapp](#webapp) : JS (React)
10- [Release](#release) : release server binaries and webapp archive to github with ansible.
11
12Dir tree
13```
14|- api/*.go api endpoints
15|- db/*.go database models
16|- cmd/
17| |--- app/
18| |-- Makefile
19| |-- conf.toml server configuration file (dev)
20| |-- main.go server entry point
21| |--- ansible/
22| |-- ansible.cfg
23| |-- hosts
24| |-- requirements.yml
25| |-- conf.toml.j2 server configuration file (prod)
26| |-- cryptoportfolio-app.j2 server systemd file
27| |-- vars.yml playbook variables (vault)
28| |-- release.yml release playbook
29| |-- deploy.yml deploy playbook
30| |--- web/
31| |-- env/ app environments
32| |-- dev.env
33| |-- prod.env
34| |-- js/ js source code
35| |-- static/ index.html and style.css
36```
37## Server
38#### Install
39##### Golang installation (if needed)
401. Download right package at [https://golang.org/dl](https://golang.org/dl)
412. Install it
42```
43tar -C /usr/local -xzf go$VERSION.$OS-$ARCH.tar.gz
44
45export PATH=$PATH:/usr/local/go/bin
46```
47#### Fetch dependencies
48Simply run at the root of project :
49```
50 make install
51```
52#### Run locally
53You need postgres running on `localhost:5432` and the following setup:
54```
55CREATE USER cryptoportfolio;
56ALTER USER cryptoportfolio WITH ENCRYPTED PASSWORD 'cryptoporfolio-dev';
57ALTER ROLE cryptoportfolio WITH CREATEDB ;
58CREATE DATABASE cryptoportfolio OWNER cryptoportfolio;
59```
60Then run the app in cmd/app:
61```
62 cd cmd/app
63 make run
64```
65## Webapp
66#### Install
67You will need `npm`, `node` and `yarn`, then:
68```
69 cd cmd/web
70 make install
71```
72
73#### Build local webapp
74```
75 make static ENV=dev
76```
77Files are now ready to be served by server.
78
79## Ansible install requirements
80```
81cd cmd/ansible
82
83ansible-galaxy install -r requirements.yml
84```
85## Releasing
86To release, you need to have all dev environments setup for server and webapp. The token used to push to Github is in cmd/ansible/vars.yml. You need a password to decrypt this file. Ask me. You need to store this password in a file such as `~/.vault_cryptoportfolio_pass.txt`
87
88You can then run the release.yml playbook, don't forget to provide a the release version :
89```
90 cd cmd/ansible
91
92 ansible-playbook release.yml --extra-vars "version=X.X.X" --vault-password-file=~/.vault_cryptoportfolio_pass.txt
93```
94## Deploy
95change `hosts` file :
96```
97[jloup-home]
98jlj.am
99
100[jloup-home:vars]
101 ansible_port=21
102 ansible_user=ansible-deploy # This user will be used to carry out operation on remote machine
103 # To make it work, this user should not be prompted for password when sudo
104 # else you need to pass --ask-sudo-pass when running playbook
105
106 app_user=jloup # user that will run the app service
107 app_domain=jlj.am
108
109 postgres_database=cryptoportfolio
110 postgres_user=cryptoportfolio
111 postgres_password=cryptoportfolio-dev
112
113 linux_arch=386 # your machine arch. should be one if [386, amd64]
114```
115
116```
117 cd cmd/ansible
118
119 ansible-playbook deploy.yml --extra-vars "version=X.X.X" --vault-password-file=~/.vault_cryptoportfolio_pass.txt
120```