rename starter-pack to referral-service
Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
parent
27bdb54fbc
commit
e3ac0abd93
|
@ -1,11 +1,11 @@
|
|||
# Description
|
||||
|
||||
This repo configures infrastructure for the [starterpack-service](https://github.com/status-im/starterpack-service).
|
||||
This repo configures infrastructure for the [referral-service](https://github.com/status-im/referral-service).
|
||||
|
||||
# Endpoints
|
||||
|
||||
* https://prod-starter-pack.status.im/ - Production
|
||||
* https://test-starter-pack.status.im/ - Testing
|
||||
* https://prod-referral.status.im/ - Production
|
||||
* https://test-referral.status.im/ - Testing
|
||||
|
||||
# Repo Usage
|
||||
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
---
|
||||
# required service env variables
|
||||
referral_srv_google_auth_json: 'TODO'
|
||||
referral_srv_apple_secret: 'TODO'
|
||||
referral_srv_eth_http_endpoint: '{{lookup("passwordstore", "service/referral-service/test/eth/endpoint")}}'
|
||||
referral_srv_eth_contract_address: '{{lookup("passwordstore", "service/referral-service/test/eth/contract-addr")}}'
|
||||
referral_srv_eth_contract_name: '{{lookup("passwordstore", "service/referral-service/test/eth/contract-name")}}'
|
||||
referral_srv_eth_private_key: '{{lookup("passwordstore", "service/referral-service/test/eth/priv-key")}}'
|
||||
referral_srv_secret_key_base: '{{lookup("passwordstore", "service/referral-service/test/secret-key-base")}}'
|
||||
|
||||
# Referral Service API port
|
||||
referral_srv_app_port: 3000
|
||||
|
||||
# add a swap file to avoid memory issues when syncing
|
||||
swap_file_size_mb: 2048
|
||||
|
||||
# Proxy for WSGI server assumed to run on port 8000
|
||||
nginx_sites:
|
||||
referral_service:
|
||||
- listen 443 ssl
|
||||
|
||||
- server_name {{ stage }}.starter-pack.status.im
|
||||
|
||||
- ssl_certificate /certs/status.im/origin.crt
|
||||
- ssl_certificate_key /certs/status.im/origin.key
|
||||
|
||||
- location / {
|
||||
proxy_pass http://localhost:{{ referral_srv_app_port }}/;
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
---
|
||||
# required service env variables
|
||||
starterpack_google_auth_json: 'TODO'
|
||||
starterpack_apple_secret: 'TODO'
|
||||
starterpack_eth_http_endpoint: '{{lookup("passwordstore", "service/starterpack/test/eth/endpoint")}}'
|
||||
starterpack_eth_contract_address: '{{lookup("passwordstore", "service/starterpack/test/eth/contract-addr")}}'
|
||||
starterpack_eth_contract_name: '{{lookup("passwordstore", "service/starterpack/test/eth/contract-name")}}'
|
||||
starterpack_eth_private_key: '{{lookup("passwordstore", "service/starterpack/test/eth/priv-key")}}'
|
||||
starterpack_secret_key_base: '{{lookup("passwordstore", "service/starterpack/test/secret-key-base")}}'
|
||||
|
||||
# Starter Pack API port
|
||||
starterpack_app_port: 3000
|
||||
|
||||
# add a swap file to avoid memory issues when syncing
|
||||
swap_file_size_mb: 2048
|
||||
|
||||
# Proxy for WSGI server assumed to run on port 8000
|
||||
nginx_sites:
|
||||
starter_pack:
|
||||
- listen 443 ssl
|
||||
|
||||
- server_name {{ stage }}.starter-pack.status.im
|
||||
|
||||
- ssl_certificate /certs/status.im/origin.crt
|
||||
- ssl_certificate_key /certs/status.im/origin.key
|
||||
|
||||
- location / {
|
||||
proxy_pass http://localhost:{{ starterpack_app_port }}/;
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
# NOTE: This file is generated by terraform.py
|
||||
# For emergency use when Consul fails
|
||||
[all]
|
||||
node-01.do-ams3.starter.test hostname=node-01.do-ams3.starter.test ansible_host=134.209.136.233 env=starter stage=test data_center=do-ams3 region=ams3 dns_entry=node-01.do-ams3.starter.test.statusim.net
|
||||
|
||||
[do-ams3]
|
||||
node-01.do-ams3.starter.test
|
||||
|
||||
[starter]
|
||||
node-01.do-ams3.starter.test
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
---
|
||||
- name: Configure Starter Pack host
|
||||
hosts: starter
|
||||
- name: Configure Referral service host
|
||||
hosts: referral
|
||||
roles:
|
||||
- { role: origin-certs, tags: origin-certs }
|
||||
- { role: swap-file, tags: swap-file }
|
||||
- { role: starterpack, tags: starterpack }
|
||||
- { role: nginx, tags: nginx }
|
||||
- { role: threatstack, tags: threatstack }
|
||||
- { role: origin-certs, tags: origin-certs }
|
||||
- { role: swap-file, tags: swap-file }
|
||||
- { role: referral-service, tags: referral-service }
|
||||
- { role: nginx, tags: nginx }
|
||||
- { role: threatstack, tags: threatstack }
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
# Description
|
||||
|
||||
This role configures the [referral-service](https://github.com/status-im/referral-service) which purpose is to
|
||||
|
||||
# Configuration
|
||||
|
||||
Mostly the service requires certain secrets to be set:
|
||||
```yaml
|
||||
# for production cookies
|
||||
referral_srv_secret_key_base: '128charLongHexadecimal'
|
||||
|
||||
# For Play Store integration
|
||||
referral_srv_google_product_id: 'referral.0'
|
||||
referral_srv_google_package_name: 'im.status.ethereum'
|
||||
referral_srv_google_auth_json: '{"AUTH":"JSON"}'
|
||||
|
||||
# For sending transactions via Infura
|
||||
referral_srv_eth_http_endpoint: 'https://mainnet.infura.io/v1/ABC'
|
||||
referral_srv_eth_contract_address: '0x1234'
|
||||
referral_srv_eth_contract_name: 'Whatever'
|
||||
referral_srv_eth_private_key: '0x4321'
|
||||
```
|
||||
|
||||
# Management
|
||||
|
||||
There are 4 containers in total:
|
||||
```
|
||||
$ docker ps
|
||||
CONTAINER ID NAMES IMAGE CREATED STATUS
|
||||
73944b7f9b8b referral-app statusteam/referral:deploy-test 2 hours ago Up 2 hours
|
||||
69c684944dd7 referral-queue statusteam/referral:deploy-test 2 hours ago Up 2 hours
|
||||
d08c1de07f06 referral-cache redis:5.0-alpine 2 hours ago Up 2 hours
|
||||
bef8a88c79db referral-db postgres:9.6-alpine 2 hours ago Up 2 hours
|
||||
```
|
||||
|
||||
And they are created using [Docker Compose](https://docs.docker.com/compose/), which is also the best way to manage them:
|
||||
```
|
||||
$ cd /docker/referral
|
||||
$ sudo docker-compose ps
|
||||
Name Command State Ports
|
||||
-----------------------------------------------------------------------------------
|
||||
referral-app bundle exec puma -C config ... Up 0.0.0.0:3000->3000/tcp
|
||||
referral-cache redis-server Up 6379/tcp
|
||||
referral-db docker-entrypoint.sh postgres Up 5432/tcp
|
||||
referral-queue bundle exec sidekiq Up
|
||||
```
|
||||
To re-create the containers simply run:
|
||||
```
|
||||
$ sudo docker-compose up -d --force-recreate
|
||||
```
|
|
@ -0,0 +1,56 @@
|
|||
---
|
||||
# Key base for production cookies
|
||||
referral_srv_secret_key_base: ~
|
||||
|
||||
# required service env variables
|
||||
referral_srv_google_product_id: 'referral-service.0'
|
||||
referral_srv_google_package_name: 'im.status.ethereum'
|
||||
referral_srv_google_auth_json: ~
|
||||
referral_srv_google_auth_json_file: 'google-auth.json'
|
||||
|
||||
# Ethereum contract
|
||||
referral_srv_eth_http_endpoint: ~
|
||||
referral_srv_eth_contract_address: ~
|
||||
referral_srv_eth_contract_name: ~
|
||||
referral_srv_eth_private_key: ~
|
||||
|
||||
referral_srv_service_name: 'referral'
|
||||
referral_srv_service_path: '/docker/{{ referral_srv_service_name }}'
|
||||
referral_srv_service_compose: '{{ referral_srv_service_path }}/docker-compose.yml'
|
||||
referral_srv_service_repo: 'git@github.com:status-im/referral-service.git'
|
||||
|
||||
# Rails application hosted with puma
|
||||
referral_srv_app_name: '{{ referral_srv_service_name }}-app'
|
||||
referral_srv_app_tag: 'deploy-test'
|
||||
referral_srv_app_image: 'statusteam/referral-service:{{ referral_srv_app_tag }}'
|
||||
referral_srv_app_vol: '{{ referral_srv_service_path }}/app'
|
||||
referral_srv_app_port: 3000
|
||||
|
||||
# Sidekiq for running jobs
|
||||
referral_srv_queue_name: '{{ referral_srv_service_name }}-queue'
|
||||
referral_srv_queue_image: '{{ referral_srv_app_image }}'
|
||||
|
||||
# PostgreSQL for data storage
|
||||
referral_srv_db_cont_name: '{{ referral_srv_service_name }}-db'
|
||||
referral_srv_db_tag: '9.6-alpine'
|
||||
referral_srv_db_image: 'postgres:{{ referral_srv_db_tag }}'
|
||||
referral_srv_db_vol: '{{ referral_srv_service_path }}/db'
|
||||
referral_srv_db_uid: 70
|
||||
referral_srv_db_host_uid: '{{ 100000 + referral_srv_db_uid | int }}'
|
||||
referral_srv_db_port: '5432'
|
||||
referral_srv_db_name: 'referral'
|
||||
referral_srv_db_user: 'referral'
|
||||
referral_srv_db_pass: 'changeIfYouCare'
|
||||
|
||||
# Redis for transaction cache
|
||||
referral_srv_cache_name: '{{ referral_srv_service_name }}-cache'
|
||||
referral_srv_cache_tag: '5.0-alpine'
|
||||
referral_srv_cache_image: 'redis:{{ referral_srv_cache_tag }}'
|
||||
referral_srv_cache_vol: '{{ referral_srv_service_path }}/cache'
|
||||
referral_srv_cache_port: 6379
|
||||
referral_srv_cache_db: '0'
|
||||
|
||||
# general container management
|
||||
compose_state: 'present'
|
||||
compose_recreate: 'smart'
|
||||
compose_restart: false
|
|
@ -1,32 +1,32 @@
|
|||
---
|
||||
- name: 'Create container config: {{ starterpack_service_name }}'
|
||||
- name: 'Create container config: {{ referral_srv_service_name }}'
|
||||
set_fact:
|
||||
starterpack_compose:
|
||||
referral_srv_compose:
|
||||
version: '3.7'
|
||||
services:
|
||||
app:
|
||||
container_name: '{{ starterpack_app_name }}'
|
||||
image: '{{ starterpack_app_image }}'
|
||||
container_name: '{{ referral_srv_app_name }}'
|
||||
image: '{{ referral_srv_app_image }}'
|
||||
restart: 'always'
|
||||
env_file: '{{ starterpack_service_path }}/app.env'
|
||||
env_file: '{{ referral_srv_service_path }}/app.env'
|
||||
deploy:
|
||||
labels:
|
||||
# automatic image updates
|
||||
com.centurylinklabs.watchtower.enable: 'true'
|
||||
ports:
|
||||
- '{{ starterpack_app_port }}:{{ starterpack_app_port }}/tcp'
|
||||
- '{{ referral_srv_app_port }}:{{ referral_srv_app_port }}/tcp'
|
||||
volumes:
|
||||
- '{{ starterpack_app_vol }}:/data'
|
||||
- '{{ referral_srv_app_vol }}:/data'
|
||||
depends_on:
|
||||
- 'db'
|
||||
- 'cache'
|
||||
- 'queue'
|
||||
|
||||
queue:
|
||||
container_name: '{{ starterpack_queue_name }}'
|
||||
image: '{{ starterpack_queue_image }}'
|
||||
container_name: '{{ referral_srv_queue_name }}'
|
||||
image: '{{ referral_srv_queue_image }}'
|
||||
restart: 'always'
|
||||
env_file: '{{ starterpack_service_path }}/app.env'
|
||||
env_file: '{{ referral_srv_service_path }}/app.env'
|
||||
command: 'sidekiq'
|
||||
deploy:
|
||||
labels:
|
||||
|
@ -37,22 +37,22 @@
|
|||
- 'cache'
|
||||
|
||||
db:
|
||||
container_name: '{{ starterpack_db_cont_name }}'
|
||||
image: '{{ starterpack_db_image }}'
|
||||
container_name: '{{ referral_srv_db_cont_name }}'
|
||||
image: '{{ referral_srv_db_image }}'
|
||||
user: root
|
||||
restart: 'always'
|
||||
env_file: '{{ starterpack_service_path }}/db.env'
|
||||
env_file: '{{ referral_srv_service_path }}/db.env'
|
||||
tmpfs:
|
||||
- '/run/postgresql'
|
||||
- '/tmp'
|
||||
volumes:
|
||||
- '{{ starterpack_db_vol }}:/var/lib/postgresql/data'
|
||||
- '{{ referral_srv_db_vol }}:/var/lib/postgresql/data'
|
||||
|
||||
cache:
|
||||
container_name: '{{ starterpack_cache_name }}'
|
||||
image: '{{ starterpack_cache_image }}'
|
||||
container_name: '{{ referral_srv_cache_name }}'
|
||||
image: '{{ referral_srv_cache_image }}'
|
||||
restart: 'always'
|
||||
# docker-entrypoint.sh tries to chown /data which will not work
|
||||
entrypoint: redis-server
|
||||
volumes:
|
||||
- '{{ starterpack_cache_vol }}:/data'
|
||||
- '{{ referral_srv_cache_vol }}:/data'
|
|
@ -0,0 +1,15 @@
|
|||
---
|
||||
- name: Create Consul service definition
|
||||
include_role: name=consul-service
|
||||
vars:
|
||||
consul_config_name: '{{ referral_srv_service_name }}'
|
||||
consul_services:
|
||||
- name: '{{ referral_srv_service_name }}'
|
||||
tags: ['referral', 'purchase']
|
||||
# we advertise the port with basic auth
|
||||
port: '{{ referral_srv_app_port }}'
|
||||
checks:
|
||||
- id: '{{ referral_srv_service_name }}-health'
|
||||
name: Referral Service Healthcheck
|
||||
type: http
|
||||
http: 'http://localhost:{{ referral_srv_app_port }}/health'
|
|
@ -0,0 +1,17 @@
|
|||
---
|
||||
- name: 'Create compose file: {{ referral_srv_service_name }}'
|
||||
copy:
|
||||
dest: '{{ referral_srv_service_compose }}'
|
||||
content: '{{ referral_srv_compose | to_nice_yaml }}'
|
||||
owner: dockremap
|
||||
group: docker
|
||||
mode: 0644
|
||||
|
||||
- name: 'Create containers: {{ referral_srv_service_name }}'
|
||||
docker_compose:
|
||||
project_src: '{{ referral_srv_service_path }}'
|
||||
state: '{{ compose_state }}'
|
||||
recreate: '{{ compose_recreate }}'
|
||||
restarted: '{{ compose_restart }}'
|
||||
pull: false
|
||||
build: no
|
|
@ -6,14 +6,14 @@
|
|||
group: docker
|
||||
state: directory
|
||||
with_items:
|
||||
- '{{ starterpack_service_path }}'
|
||||
- '{{ starterpack_app_vol }}'
|
||||
- '{{ starterpack_cache_vol }}'
|
||||
- '{{ referral_srv_service_path }}'
|
||||
- '{{ referral_srv_app_vol }}'
|
||||
- '{{ referral_srv_cache_vol }}'
|
||||
|
||||
- name: Create database folder
|
||||
file:
|
||||
path: '{{ starterpack_db_vol }}'
|
||||
owner: '{{ starterpack_db_host_uid }}'
|
||||
path: '{{ referral_srv_db_vol }}'
|
||||
owner: '{{ referral_srv_db_host_uid }}'
|
||||
group: docker
|
||||
mode: 0777
|
||||
state: directory
|
||||
|
@ -21,17 +21,17 @@
|
|||
- name: Create env file for app
|
||||
template:
|
||||
src: 'app.env.j2'
|
||||
dest: '{{ starterpack_service_path }}/app.env'
|
||||
dest: '{{ referral_srv_service_path }}/app.env'
|
||||
mode: 0640
|
||||
|
||||
- name: Create env file for db
|
||||
template:
|
||||
src: 'db.env.j2'
|
||||
dest: '{{ starterpack_service_path }}/db.env'
|
||||
dest: '{{ referral_srv_service_path }}/db.env'
|
||||
mode: 0640
|
||||
|
||||
- name: Create the Google Auth JSON file
|
||||
copy:
|
||||
dest: '{{ starterpack_app_vol }}/{{ starterpack_google_auth_json_file }}'
|
||||
content: '{{ starterpack_google_auth_json | mandatory }}'
|
||||
dest: '{{ referral_srv_app_vol }}/{{ referral_srv_google_auth_json_file }}'
|
||||
content: '{{ referral_srv_google_auth_json | mandatory }}'
|
||||
mode: 0640
|
|
@ -1,14 +1,14 @@
|
|||
---
|
||||
- name: Create repo directory
|
||||
file:
|
||||
path: '{{ starterpack_service_path }}/repo'
|
||||
path: '{{ referral_srv_service_path }}/repo'
|
||||
state: directory
|
||||
owner: '{{ ansible_user }}'
|
||||
|
||||
- name: Clone starterpack repo
|
||||
- name: Clone referral service repo
|
||||
git:
|
||||
repo: '{{ starterpack_service_repo }}'
|
||||
dest: '{{ starterpack_service_path }}/repo'
|
||||
repo: '{{ referral_srv_service_repo }}'
|
||||
dest: '{{ referral_srv_service_path }}/repo'
|
||||
version: chore/move-to-rails
|
||||
update: true
|
||||
accept_hostkey: yes
|
||||
|
@ -16,11 +16,11 @@
|
|||
become: false
|
||||
register: repo_clone
|
||||
|
||||
- name: Build the starterpack image
|
||||
- name: Build the referral service image
|
||||
docker_image:
|
||||
name: '{{ starterpack_app_image }}'
|
||||
name: '{{ referral_srv_app_image }}'
|
||||
build:
|
||||
path: '{{ starterpack_service_path }}/repo/server'
|
||||
path: '{{ referral_srv_service_path }}/repo/server'
|
||||
rm: true
|
||||
pull: false
|
||||
source: build
|
|
@ -0,0 +1,30 @@
|
|||
# Application
|
||||
RAILS_ENV=production
|
||||
RAILS_MAX_THREADS={{ ansible_processor_vcpus }}
|
||||
SECRET_KEY_BASE={{ referral_srv_secret_key_base | mandatory }}
|
||||
PORT={{ referral_srv_app_port }}
|
||||
PIDFILE=/tmp/app.pid
|
||||
|
||||
# Apple App Store
|
||||
#APPLE_AUTH_SECRET={{ referral_srv_apple_secret }}
|
||||
|
||||
# Google Play Store
|
||||
GOOGLE_PRODUCT_ID={{ referral_srv_google_product_id }}
|
||||
GOOGLE_PACKAGE_NAME={{ referral_srv_google_package_name }}
|
||||
GOOGLE_AUTH_JSON=/data/{{ referral_srv_google_auth_json_file }}
|
||||
|
||||
# Ethereum Contract
|
||||
ETHEREUM_HTTP_ENDPOINT={{ referral_srv_eth_http_endpoint | mandatory }}
|
||||
ETHEREUM_CONTRACT_ADDRESS={{ referral_srv_eth_contract_address | mandatory }}
|
||||
ETHEREUM_CONTRACT_NAME={{ referral_srv_eth_contract_name | mandatory }}
|
||||
ETHEREUM_PRIVATE_KEY={{ referral_srv_eth_private_key | mandatory }}
|
||||
|
||||
# Database config for permanent storage
|
||||
DATABASE_HOST=db
|
||||
DATABASE_PORT={{ referral_srv_db_port }}
|
||||
DATABASE_NAME={{ referral_srv_db_name }}
|
||||
DATABASE_USER={{ referral_srv_db_user }}
|
||||
DATABASE_PASS={{ referral_srv_db_pass }}
|
||||
|
||||
# Cache config for queue/locks
|
||||
REDIS_URL=redis://cache:{{ referral_srv_cache_port }}/{{ referral_srv_cache_db }}
|
|
@ -0,0 +1,7 @@
|
|||
# Initial DB access
|
||||
POSTGRES_DB={{ referral_srv_db_name }}
|
||||
POSTGRES_USER={{ referral_srv_db_user }}
|
||||
POSTGRES_PASSWORD={{ referral_srv_db_pass | mandatory }}
|
||||
|
||||
# fixes chmod errors on DB startup due to volume + userns-remap
|
||||
PGDATA=/var/lib/postgresql/data/pgdata
|
|
@ -1,50 +0,0 @@
|
|||
# Description
|
||||
|
||||
This role configures the [starterpack-service](https://github.com/status-im/starterpack-service) which purpose is to
|
||||
|
||||
# Configuration
|
||||
|
||||
Mostly the service requires certain secrets to be set:
|
||||
```yaml
|
||||
# for production cookies
|
||||
starterpack_secret_key_base: '128charLongHexadecimal'
|
||||
|
||||
# For Play Store integration
|
||||
starterpack_google_product_id: 'starterpack.0'
|
||||
starterpack_google_package_name: 'im.status.ethereum'
|
||||
starterpack_google_auth_json: '{"AUTH":"JSON"}'
|
||||
|
||||
# For sending transactions via Infura
|
||||
starterpack_eth_http_endpoint: 'https://mainnet.infura.io/v1/ABC'
|
||||
starterpack_eth_contract_address: '0x1234'
|
||||
starterpack_eth_contract_name: 'Whatever'
|
||||
starterpack_eth_private_key: '0x4321'
|
||||
```
|
||||
|
||||
# Management
|
||||
|
||||
There are 4 containers in total:
|
||||
```
|
||||
$ docker ps
|
||||
CONTAINER ID NAMES IMAGE CREATED STATUS
|
||||
73944b7f9b8b starterpack-app statusteam/starterpack:deploy-test 2 hours ago Up 2 hours
|
||||
69c684944dd7 starterpack-queue statusteam/starterpack:deploy-test 2 hours ago Up 2 hours
|
||||
d08c1de07f06 starterpack-cache redis:5.0-alpine 2 hours ago Up 2 hours
|
||||
bef8a88c79db starterpack-db postgres:9.6-alpine 2 hours ago Up 2 hours
|
||||
```
|
||||
|
||||
And they are created using [Docker Compose](https://docs.docker.com/compose/), which is also the best way to manage them:
|
||||
```
|
||||
$ cd /docker/starterpack
|
||||
$ sudo docker-compose ps
|
||||
Name Command State Ports
|
||||
-----------------------------------------------------------------------------------
|
||||
starterpack-app bundle exec puma -C config ... Up 0.0.0.0:3000->3000/tcp
|
||||
starterpack-cache redis-server Up 6379/tcp
|
||||
starterpack-db docker-entrypoint.sh postgres Up 5432/tcp
|
||||
starterpack-queue bundle exec sidekiq Up
|
||||
```
|
||||
To re-create the containers simply run:
|
||||
```
|
||||
$ sudo docker-compose up -d --force-recreate
|
||||
```
|
|
@ -1,56 +0,0 @@
|
|||
---
|
||||
# Key base for production cookies
|
||||
starterpack_secret_key_base: ~
|
||||
|
||||
# required service env variables
|
||||
starterpack_google_product_id: 'starterpack.0'
|
||||
starterpack_google_package_name: 'im.status.ethereum'
|
||||
starterpack_google_auth_json: ~
|
||||
starterpack_google_auth_json_file: 'google-auth.json'
|
||||
|
||||
# Ethereum contract
|
||||
starterpack_eth_http_endpoint: ~
|
||||
starterpack_eth_contract_address: ~
|
||||
starterpack_eth_contract_name: ~
|
||||
starterpack_eth_private_key: ~
|
||||
|
||||
starterpack_service_name: 'starterpack'
|
||||
starterpack_service_path: '/docker/{{ starterpack_service_name }}'
|
||||
starterpack_service_compose: '{{ starterpack_service_path }}/docker-compose.yml'
|
||||
starterpack_service_repo: 'git@github.com:status-im/starterpack-service.git'
|
||||
|
||||
# Rails application hosted with puma
|
||||
starterpack_app_name: '{{ starterpack_service_name }}-app'
|
||||
starterpack_app_tag: 'deploy-test'
|
||||
starterpack_app_image: 'statusteam/starterpack:{{ starterpack_app_tag }}'
|
||||
starterpack_app_vol: '{{ starterpack_service_path }}/app'
|
||||
starterpack_app_port: 3000
|
||||
|
||||
# Sidekiq for running jobs
|
||||
starterpack_queue_name: '{{ starterpack_service_name }}-queue'
|
||||
starterpack_queue_image: '{{ starterpack_app_image }}'
|
||||
|
||||
# PostgreSQL for data storage
|
||||
starterpack_db_cont_name: '{{ starterpack_service_name }}-db'
|
||||
starterpack_db_tag: '9.6-alpine'
|
||||
starterpack_db_image: 'postgres:{{ starterpack_db_tag }}'
|
||||
starterpack_db_vol: '{{ starterpack_service_path }}/db'
|
||||
starterpack_db_uid: 70
|
||||
starterpack_db_host_uid: '{{ 100000 + starterpack_db_uid | int }}'
|
||||
starterpack_db_port: '5432'
|
||||
starterpack_db_name: 'starterpack'
|
||||
starterpack_db_user: 'starterpack'
|
||||
starterpack_db_pass: 'changeIfYouCare'
|
||||
|
||||
# Redis for transaction cache
|
||||
starterpack_cache_name: '{{ starterpack_service_name }}-cache'
|
||||
starterpack_cache_tag: '5.0-alpine'
|
||||
starterpack_cache_image: 'redis:{{ starterpack_cache_tag }}'
|
||||
starterpack_cache_vol: '{{ starterpack_service_path }}/cache'
|
||||
starterpack_cache_port: 6379
|
||||
starterpack_cache_db: '0'
|
||||
|
||||
# general container management
|
||||
compose_state: 'present'
|
||||
compose_recreate: 'smart'
|
||||
compose_restart: false
|
|
@ -1,15 +0,0 @@
|
|||
---
|
||||
- name: Create Consul service definition
|
||||
include_role: name=consul-service
|
||||
vars:
|
||||
consul_config_name: '{{ starterpack_service_name }}'
|
||||
consul_services:
|
||||
- name: '{{ starterpack_service_name }}'
|
||||
tags: ['starter-pack', 'purchase']
|
||||
# we advertise the port with basic auth
|
||||
port: '{{ starterpack_app_port }}'
|
||||
checks:
|
||||
- id: '{{ starterpack_service_name }}-health'
|
||||
name: Starter Pack Healthcheck
|
||||
type: http
|
||||
http: 'http://localhost:{{ starterpack_app_port }}/health'
|
|
@ -1,17 +0,0 @@
|
|||
---
|
||||
- name: 'Create compose file: {{ starterpack_service_name }}'
|
||||
copy:
|
||||
dest: '{{ starterpack_service_compose }}'
|
||||
content: '{{ starterpack_compose | to_nice_yaml }}'
|
||||
owner: dockremap
|
||||
group: docker
|
||||
mode: 0644
|
||||
|
||||
- name: 'Create containers: {{ starterpack_service_name }}'
|
||||
docker_compose:
|
||||
project_src: '{{ starterpack_service_path }}'
|
||||
state: '{{ compose_state }}'
|
||||
recreate: '{{ compose_recreate }}'
|
||||
restarted: '{{ compose_restart }}'
|
||||
pull: false
|
||||
build: no
|
|
@ -1,30 +0,0 @@
|
|||
# Application
|
||||
RAILS_ENV=production
|
||||
RAILS_MAX_THREADS={{ ansible_processor_vcpus }}
|
||||
SECRET_KEY_BASE={{ starterpack_secret_key_base | mandatory }}
|
||||
PORT={{ starterpack_app_port }}
|
||||
PIDFILE=/tmp/app.pid
|
||||
|
||||
# Apple App Store
|
||||
#APPLE_AUTH_SECRET={{ starterpack_apple_secret }}
|
||||
|
||||
# Google Play Store
|
||||
GOOGLE_PRODUCT_ID={{ starterpack_google_product_id }}
|
||||
GOOGLE_PACKAGE_NAME={{ starterpack_google_package_name }}
|
||||
GOOGLE_AUTH_JSON=/data/{{ starterpack_google_auth_json_file }}
|
||||
|
||||
# Ethereum Contract
|
||||
ETHEREUM_HTTP_ENDPOINT={{ starterpack_eth_http_endpoint | mandatory }}
|
||||
ETHEREUM_CONTRACT_ADDRESS={{ starterpack_eth_contract_address | mandatory }}
|
||||
ETHEREUM_CONTRACT_NAME={{ starterpack_eth_contract_name | mandatory }}
|
||||
ETHEREUM_PRIVATE_KEY={{ starterpack_eth_private_key | mandatory }}
|
||||
|
||||
# Database config for permanent storage
|
||||
DATABASE_HOST=db
|
||||
DATABASE_PORT={{ starterpack_db_port }}
|
||||
DATABASE_NAME={{ starterpack_db_name }}
|
||||
DATABASE_USER={{ starterpack_db_user }}
|
||||
DATABASE_PASS={{ starterpack_db_pass }}
|
||||
|
||||
# Cache config for queue/locks
|
||||
REDIS_URL=redis://cache:{{ starterpack_cache_port }}/{{ starterpack_cache_db }}
|
|
@ -1,7 +0,0 @@
|
|||
# Initial DB access
|
||||
POSTGRES_DB={{ starterpack_db_name }}
|
||||
POSTGRES_USER={{ starterpack_db_user }}
|
||||
POSTGRES_PASSWORD={{ starterpack_db_pass | mandatory }}
|
||||
|
||||
# fixes chmod errors on DB startup due to volume + userns-remap
|
||||
PGDATA=/var/lib/postgresql/data/pgdata
|
10
host.tf
10
host.tf
|
@ -1,13 +1,13 @@
|
|||
/**
|
||||
* This is a dev machine for developing the Starter Pack service.
|
||||
* https://github.com/status-im/starterpack-service
|
||||
* This is a dev machine for developing the Referral service.
|
||||
* https://github.com/status-im/referral-service
|
||||
**/
|
||||
|
||||
module "main" {
|
||||
source = "github.com/status-im/infra-tf-digital-ocean"
|
||||
host_count = 1
|
||||
env = "starter"
|
||||
group = "starter"
|
||||
env = "referral"
|
||||
group = "referral"
|
||||
size = "s-1vcpu-2gb"
|
||||
domain = var.domain
|
||||
|
||||
|
@ -16,7 +16,7 @@ module "main" {
|
|||
|
||||
resource "cloudflare_record" "main" {
|
||||
zone_id = local.zones["status.im"]
|
||||
name = "${terraform.workspace}-starter-pack"
|
||||
name = "${terraform.workspace}-referral"
|
||||
type = "A"
|
||||
proxied = true
|
||||
value = module.main.public_ips[0]
|
||||
|
|
2
main.tf
2
main.tf
|
@ -21,7 +21,7 @@ terraform {
|
|||
/* KV store has a limit of 512KB */
|
||||
gzip = true
|
||||
/* WARNING This needs to be changed for every repo. */
|
||||
path = "terraform/starter-pack/"
|
||||
path = "terraform/referral-service/"
|
||||
ca_file = "ansible/files/consul-ca.crt"
|
||||
cert_file = "ansible/files/consul-client.crt"
|
||||
key_file = "ansible/files/consul-client.key"
|
||||
|
|
Loading…
Reference in New Issue