~chicharreros/magicicada-server/trunk

« back to all changes in this revision

Viewing changes to README.rst

  • Committer: Magicicada Bot
  • Author(s): Natalia
  • Date: 2016-09-01 12:51:22 UTC
  • mfrom: (73.1.5 split-start-db)
  • Revision ID: magicicada_bot-20160901125122-caz7wws0e89mgxny
[r=facundo] - Split DB creation and start up to be able to use a system DB.

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
ask you to write the "Common Name (e.g. server FQDN or YOUR name)", I found
37
37
that what you put there needs to match the '--host' parameter you pass to the
38
38
client (see below, in the part where the client is started), so this host name
39
 
must be such the client machine can ping it.
 
39
must be such the client machine can ping it::
40
40
 
41
 
::
42
41
    openssl req -new -x509 -key privkey.pem -out cacert.pem -days 1095
43
42
 
44
43
The just generated 'privkey.pem' and 'cacert.pem' will be used below.
52
51
Start with a clean Ubuntu Xenial environment (e.g., in a VPS, or using
53
52
an LXC). As example, if you want to create a Xenial LXC, you can use::
54
53
 
55
 
    sudo lxc-create -t ubuntu -n magicicada-xenial -- -r xenial \
56
 
        -a amd64 -b $USER
 
54
    sudo lxc-create -t ubuntu -n magicicada-xenial -- -r xenial -a amd64 -b $USER
 
55
 
 
56
Dependencies
 
57
^^^^^^^^^^^^
57
58
 
58
59
Then you need to start the LXC instance and ssh into it::
59
60
 
78
79
or client" section are copied into the ~/magicicada/magicicada-server/certs
79
80
folder.
80
81
 
81
 
Start the server::
 
82
Using a system-level database
 
83
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
84
 
 
85
Assuming you created a Postgresql 9.5 database named "filesync" with a
 
86
"magicicada" user as owner::
 
87
 
 
88
    sudo su - postgres
 
89
    createuser magicicada -P
 
90
    createdb filesync -O magicicada
 
91
 
 
92
Edit or create the file magicicada/settings/local.py so it looks like this::
 
93
 
 
94
    DATABASES = {
 
95
        'default': {
 
96
            'ENGINE': 'django.db.backends.postgresql_psycopg2',
 
97
            'NAME': 'filesync',
 
98
            'HOST': 'localhost',
 
99
            'USER': 'magicicada',
 
100
            'PASSWORD': <what you choose in createuser>,
 
101
        },
 
102
    }
 
103
 
 
104
Then, to confirm you have configured your database correctly, run::
 
105
 
 
106
    make manage ARGS=dbshell
 
107
 
 
108
and you should obtain a prompt in the PG database. Now, create the database
 
109
schema::
 
110
 
 
111
    make manage ARGS=migrate
 
112
 
 
113
Using a temporary (in memory) database
 
114
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
115
 
 
116
If you don't want to use a system level database, ensure you have no custom
 
117
definition for the DATABASES setting in magicicada/settings/local.py, and just
 
118
run::
 
119
 
 
120
    make start-db
 
121
 
 
122
Run the filesync server
 
123
^^^^^^^^^^^^^^^^^^^^^^^
 
124
 
 
125
Start the server via command line this way::
82
126
 
83
127
    cd ~/magicicada/magicicada-server
84
128
    make start-oauth