3 Back and front end for cryptoportfolio project.
5 Server 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)
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.
14 |- api/*.go api endpoints
15 |- db/*.go database models
19 | |-- conf.toml server configuration file (dev)
20 | |-- main.go server entry point
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
31 | |-- env/ app environments
34 | |-- js/ js source code
35 | |-- static/ index.html and style.css
39 ##### Golang installation (if needed)
40 1. Download right package at [https://golang.org/dl](https://golang.org/dl)
43 tar -C /usr/local -xzf go$VERSION.$OS-$ARCH.tar.gz
45 export PATH=$PATH:/usr/local/go/bin
47 #### Fetch dependencies
48 Simply run at the root of project :
53 You need postgres running on `localhost:5432` and the following setup:
55 CREATE USER cryptoportfolio;
56 ALTER USER cryptoportfolio WITH ENCRYPTED PASSWORD 'cryptoporfolio-dev';
57 ALTER ROLE cryptoportfolio WITH CREATEDB ;
58 CREATE DATABASE cryptoportfolio OWNER cryptoportfolio;
60 Then run the app in cmd/app:
67 You will need `npm`, `node` and `yarn`, then:
73 #### Build local webapp
77 Files are now ready to be served by server.
79 ## Ansible install requirements
83 ansible-galaxy install -r requirements.yml
86 To 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`
88 You can then run the release.yml playbook, don't forget to provide a the release version :
92 ansible-playbook release.yml --extra-vars "version=X.X.X" --vault-password-file=~/.vault_cryptoportfolio_pass.txt
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
106 app_user=jloup # user that will run the app service
109 postgres_database=cryptoportfolio
110 postgres_user=cryptoportfolio
111 postgres_password=cryptoportfolio-dev
113 linux_arch=386 # your machine arch. should be one if [386, amd64]
119 ansible-playbook deploy.yml --extra-vars "version=X.X.X" --vault-password-file=~/.vault_cryptoportfolio_pass.txt