Skip to content

Instantly share code, notes, and snippets.

@kosssi
Last active January 30, 2018 10:09
Show Gist options
  • Save kosssi/65a6ef8ad1579f7410f02159d2e41bac to your computer and use it in GitHub Desktop.
Save kosssi/65a6ef8ad1579f7410f02159d2e41bac to your computer and use it in GitHub Desktop.
Install Cozy on MacOS to develope application

Installation

CouchDB

docker run -d \
    --name couch \
    -p 5984:5984 \
    -v $HOME/.cozy/couch:/opt/couchdb/data \
    apache/couchdb:2.1
sleep 4s
curl -X PUT http://127.0.0.1:5984/{_users,_replicator,_global_changes}

Cozy Stack

cozy-stack serve

Dans un autre onglet :

cozy-stack instances add --dev --apps drive,collect,settings --passphrase cozy "cozy.tools:8080" --email simon@cozycloud.cc

Quelques commandes :

cozy-stack --domain cozy.tools:8080 apps ls
cozy-stack --domain cozy.tools:8080 konnectors ls

Les applications

Installation rapide d'une application en dev :

APP_NAME=banks
APP_FOLDER=$HOME/.cozy/storage/cozy.tools\:8080/.cozy_apps/$APP_NAME
SRC_FOLDER=$HOME/dev/work/app/$APP_NAME

cozy-stack --domain cozy.tools:8080 apps install $APP_NAME file://$SRC_FOLDER/build
APP_INSTALLED=$(ls $APP_FOLDER)
rm -rf $APP_FOLDER/$APP_INSTALLED
ln -s $SRC_FOLDER/build $APP_FOLDER/$APP_INSTALLED

Les konnectors

Installation rapide d'un konnector en dev :

K_NAME=free
SRC_FOLDER=$HOME/dev/work/konnectors/$K_NAME/build

cozy-stack --domain cozy.tools:8080 konnectors install $K_NAME file://$SRC_FOLDER

Mise à jour du konnector

K_NAME=free

cozy-stack --domain cozy.tools:8080 konnectors update $K_NAME

Lancer la stack

docker start couch cozy-stack serve

Réinitialiser

Suppression de couch

docker stop couch
docker rm couch
rm -rf $HOME/.cozy/couch

Suppression des données de la stack

rm -rf $HOME/.cozy/storage
# cozy-stack configuration file
# server host - flags: --host
host: localhost
# server port - flags: --port -p
port: 8080
# how to structure the subdomains for apps - flags: --subdomains
# values:
# - nested, like https://<app>.<user>.<domain>/ (well suited for self-hosted with Let's Encrypt)
# - flat, like https://<user>-<app>.<domain>/ (easier when using wildcard TLS certificate)
subdomains: nested
# path to the directory with the assets - flags: --assets
# default is to use the assets packed in the binary
assets: ""
admin:
# server host - flags: --admin-host
host: localhost
# server port - flags: --admin-port
port: 6060
fs:
# file system url - flags: --fs-url
# default url is the directory relative to the binary: ./storage
url: file://localhost/Users/kosssi/.cozy/storage
# url: swift://openstack/?UserName={{ .Env.OS_USERNAME }}&Password={{ .Env.OS_PASSWORD }}&ProjectName={{ .Env.OS_PROJECT_NAME }}&UserDomainName={{ .Env.OS_USER_DOMAIN_NAME }}
couchdb:
# CouchDB URL - flags: --couchdb-url
url: http://localhost:5984/
cache:
# url: redis://localhost:6379/1
lock:
# url: redis://localhost:6379/2
sessions:
# url: redis://localhost:6379/3
downloads:
# url: redis://localhost:6379/4
jobs:
workers: 1
# url: redis://localhost:6379/5
konnectors:
cmd: /Users/kosssi/.cozy/scripts/konnector-node-run.sh # run connectors with node
# cmd: ./scripts/konnector-rkt-run.sh # run connectors with rkt
# cmd: ./scripts/konnector-nsjail-run.sh # run connectors with nsjail
# oauthstate: redis://localhost:6379/6
realtime:
# url: redis://localhost:6379/7
mail:
# mail noreply address - flags: --mail-noreply-address
noreply_address: noreply@localhost
# mail smtp host - flags: --mail-host
host: localhost
# mail smtp port - flags: --mail-port
port: 1025
# mail smtp username - flags: --mail-username
#username: user
# mail smtp password - flags: --mail-password
#password: pass
# disable mail tls - flags: --mail-disable-tls
disable_tls: true
# skip the certificate validation (may be useful on localhost)
skip_certificate_validation: true
# directory with the hooks scripts - flags: --hooks
hooks: ./scripts/hooks
# Auto updates scheduler
auto_updates: false
# Registries used for applications and konnectors
registries:
- https://registry.cozy.io/
log:
# logger level (debug, info, warning, panic, fatal) - flags: --log-level
level: debug
# send logs to the local syslog - flags: --log-syslog
syslog: false
# It is possible to customize some behaviors of cozy-stack in function of the
# context of an instance (the context field of the settings document of this
# instance). Here, the "beta" context is customized with.
contexts:
beta:
# Redirect to a specific route of cozy-collect after the onboarding
onboarded_redirection: collect/#/discovery/?intro
# Redirect to the photos application after login
default_redirection: drive/#/files
# Allow to customize the cozy-bar link to the help
help_link: https://forum.cozy.io/
# Coming soon applications listed in the Cozy Bar's app panel
# Will be removed when the store will be available.
coming_soon:
store:
editor: 'Cozy'
name: 'Store'
slug: 'store'
category: 'cozy'
bank:
editor: 'Cozy'
name: 'Bank'
slug: 'bank'
category: 'partners'
# claudy actions list
claudy_actions:
- desktop
- mobile
# konnectors slugs to exclude from cozy-collect
exclude_konnectors:
- a_konnector_slug
#!/bin/bash
rundir="${1}"
cd $rundir
/Users/kosssi/.nvm/versions/node/v6.12.0/bin/node index.js > /Users/kosssi/.cozy/konnectors.log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment