Browse Source

Add README, LICENSE and INSTALLING.md

Maarten van den Berg 7 years ago
parent
commit
f86999ae31

+ 24 - 19
.rbenv-vars-sample

@@ -1,32 +1,37 @@
1
-# Parameters for sending mail
2
-# smtp or mailgun
3
-MAIL_METHOD=
4
-MAIL_FROM_ADDRESS=
5
-
6
-SMTP_SERVER=
7
-SMTP_USER=
8
-SMTP_PASS=
1
+# ['production', 'development']
2
+RAILS_ENV=
9 3
 
10
-MAILGUN_DOMAIN=
11
-MAILGUN_API_KEY=
4
+# ['en', 'nl']
5
+AARDBEI_LOCALE=
12 6
 
13
-# To be used in link construction
7
+# Used in link construction, like 'localhost:3000', 'aardbei.maartenberg.nl'
14 8
 AARDBEI_HOSTNAME=
15 9
 
16
-SECRET_KEY_BASE=
17
-# ['production', 'development']
18
-RAILS_ENV=
19
-
20
-# Set to '1' if in staging and/or not running a 'real' server or assets won't work
10
+# Set '1' if RAILS_ENV is production, but you're not running a real webserver.
21 11
 RAILS_SERVE_STATIC_FILES=
22 12
 
23
-# Database credentials
13
+# Full path to the cloned directory. (Run `pwd` if unsure)
14
+AARDBEI_PATH=
15
+
16
+# Generate using `rails secret`
17
+SECRET_KEY_BASE=
18
+
19
+# Database credentials if in production
24 20
 DB_NAME=
25 21
 DB_USER=
26 22
 DB_PASS=
27 23
 
28
-# Where are we?
29
-AARDBEI_PATH=
24
+# Parameters for sending mail
25
+MAIL_FROM_ADDRESS=
26
+# ['smtp', 'sendmail', 'mailgun']
27
+MAIL_METHOD=
28
+
29
+SMTP_SERVER=
30
+SMTP_USER=
31
+SMTP_PASS=
32
+
33
+MAILGUN_DOMAIN=
34
+MAILGUN_API_KEY=
30 35
 
31 36
 # Do we bind to a socket or port?
32 37
 PUMA_BIND=

+ 258 - 0
INSTALLING.md

@@ -0,0 +1,258 @@
1
+# Requirements
2
+To run Aardbei, you will need a UNIX operating system, which basically means
3
+that you need to be running either macos or some flavour of Linux.
4
+Running on Windows might very well be possible, but I haven't tried it.
5
+
6
+The Ruby-version Aardbei uses is currently 2.3.3, and to ensure that the version
7
+is always available, and does not conflict with any system installation of some
8
+other Ruby version, the supported way to install it is by compiling from source
9
+using the platform-independent tool [rbenv], with two helper tools called
10
+[ruby-build] and [rbenv-vars].
11
+
12
+You will need the following tools installed in whatever way you like:
13
+- [Git]
14
+- Your distro's equivalent of `build-essential` (`make`, `gcc`, probably other
15
+	tools)
16
+- Development headers for `openssl`, `zlib` and `readline` (Ubuntu: `sudo apt
17
+	install libssl-dev zlib1g-dev libreadline-dev`)
18
+- Nodejs (`apt install nodejs`) for Javascript minifying.
19
+- In production: a working `postgresql` installation, with the development
20
+	headers for libpq (`apt install libpq-dev`). Other databases will probably
21
+	work because ActiveRecord should support it, but I'm using Postgres on my
22
+	own server, and haven't tested anything besides sqlite yet.
23
+- In development: libsqlite3 with development headers (`apt install
24
+	libsqlite3-dev`)
25
+
26
+# Installing rbenv, ruby-build, and rbenv-vars, and adding it to your shell
27
+
28
+## Installing rbenv
29
+To not depend on your distro's version of `rbenv` (if any), we install from
30
+rbenv's repository.
31
+
32
+Clone the rbenv repository to your home directory:
33
+
34
+```console
35
+$ git clone https://github.com/rbenv/rbenv.git ~/.rbenv
36
+```
37
+
38
+Try to compile the bash extension:
39
+
40
+```console
41
+$ cd ~/.rbenv; src/configure; make -C src; cd -
42
+```
43
+
44
+Add `rbenv` to your `$PATH` (note the double `>>`, a single `>` will trash your
45
+`.bashrc`!):
46
+
47
+```console
48
+$ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
49
+$ echo 'eval "$(rbenv init -)"' >> ~/.bashrc
50
+$ source ~/.bashrc
51
+```
52
+
53
+## Installing ruby-build, compiling ruby
54
+`ruby-build` is a plugin for `rbenv` that provides automated compilation and
55
+installation of Ruby.
56
+
57
+Create the plugin-directory, and clone the repository to it:
58
+
59
+```console
60
+$ mkdir -p ~/.rbenv/plugins
61
+$ git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
62
+```
63
+
64
+Ensure you have the dependencies listed above installed (`build-essential` and
65
+the development headers for `openssl`, `libreadline` and `zlib`). Now start the
66
+compilation of Ruby (this will take a while and will not show a progress bar):
67
+
68
+```console
69
+$ rbenv install 2.3.3
70
+```
71
+
72
+If all is well, you will get some success message, if you have an error the
73
+script usually tells you what went wrong.
74
+
75
+## Installing rbenv-vars
76
+`rbenv-vars` is another plugin for `rbenv` that allows us to easily set
77
+environment variables by listing them in the file `.rbenv-vars`.
78
+
79
+Install it by cloning the repository:
80
+
81
+```console
82
+$ git clone https://github.com/rbenv/rbenv-vars.git ~/.rbenv/plugins/rbenv-vars
83
+```
84
+
85
+Copy the template `.rbenv-vars-sample` to `.rbenv-vars`, and set the
86
+environment to `production` or `development`, and the locale to `en` or `nl`,
87
+without quotes.
88
+
89
+```
90
+RAILS_ENV=development
91
+# ...
92
+AARDBEI_LOCALE=en
93
+```
94
+
95
+Set `AARDBEI_HOSTNAME` to the hostname your copy is going to run under (in development it's going to be `localhost:3000`:
96
+
97
+```
98
+AARDBEI_HOSTNAME=aardbei.maartenberg.nl
99
+```
100
+
101
+If you're planning to run in the production environment, but without a real webserver to serve your assets, set `RAILS_SERVE_STATIC_FILES=1`.
102
+
103
+Set `AARDBEI_PATH` to the full path of the cloned directory, like `AARDBEI_PATH=/home/aardbei/aardbei`.
104
+
105
+# Installing dependencies
106
+Aardbei's dependencies in Ruby are managed using Bundler. To install it, rbenv
107
+needs to know which version of Ruby we're using. This is stored in the file
108
+`.ruby-version`.
109
+
110
+Install bundler by moving to your cloned copy of Aardbei, and running:
111
+
112
+```console
113
+$ gem install bundler
114
+```
115
+
116
+Depending on your environment, run either:
117
+
118
+```console
119
+$ bundle install --without=production # in development
120
+$ bundle install --without='development test' # in production
121
+```
122
+
123
+If all went well, run `rbenv rehash` to add the new executables to your shell,
124
+and test that the installation worked by running `rails`. You should see some
125
+output listing the available subcommands.
126
+
127
+Open up your `.rbenv-vars` again, run the command `rails secret`, and set it as your `SECRET_KEY_BASE`:
128
+
129
+```console
130
+SECRET_KEY_BASE=a3a43b...
131
+```
132
+
133
+# Setting up the database
134
+
135
+## In development: SQLite
136
+When running in the development environment, the database is saved as a file in
137
+the `db` folder. To create it, and pre-fill some test data, run this command:
138
+
139
+```console
140
+$ RAILS_ENV=development rails db:setup
141
+```
142
+
143
+Note: __The test data currently includes a hardcoded admin user, change this if
144
+needed!__
145
+
146
+## In production: Postgresql
147
+If you're not already running Postgresql, install it using `sudo apt install
148
+postgresql-9.5`.
149
+
150
+Create a database and user with the following commands:
151
+
152
+```console
153
+$ sudo -u postgres psql
154
+postgres=# CREATE ROLE aardbei WITH LOGIN PASSWORD 'aardbei123';
155
+CREATE ROLE
156
+postgres=# CREATE DATABASE aardbei WITH OWNER = aardbei;
157
+CREATE DATABASE
158
+postgres=# GRANT ALL PRIVILEGES ON DATABASE aardbei TO aardbei;
159
+GRANT
160
+postgres=# \q
161
+```
162
+
163
+You will probably want to generate a real password for the database instead of
164
+`'aardbei123'`, this can be done by running `rails secret`.
165
+
166
+Fill in your database details in `.rbenv-vars`:
167
+
168
+```
169
+DB_NAME=aardbei
170
+DB_USER=aardbei
171
+DB_PASS=aardbei123
172
+```
173
+
174
+Now set up the database:
175
+
176
+```console
177
+$ rails db:setup
178
+```
179
+
180
+# Setting up email
181
+Aardbei needs to be able to email in order to send password reset links and
182
+reminders. Set the address for the `From:` field by setting:
183
+
184
+```
185
+MAIL_FROM_ADDRESS=aardbei@maartenberg.nl
186
+```
187
+
188
+Choose one of the below methods to deliver your mails:
189
+
190
+## Using Sendmail
191
+If your system already has working `sendmail`, set `MAIL_METHOD` to `sendmail`.
192
+
193
+```
194
+MAIL_METHOD=sendmail
195
+```
196
+
197
+## Using Mailgun
198
+If you have your own domain, you can use the free [Mailgun] tier to deliver your emails. In `.rbenv-vars`, set:
199
+
200
+```
201
+MAIL_METHOD=mailgun
202
+
203
+# ...
204
+
205
+MAILGUN_DOMAIN=your.domain.mg
206
+MAILGUN_API_KEY=key-abcdefpdftexexezip
207
+```
208
+
209
+## Using SMTP
210
+You can use a SMTP server. Set:
211
+
212
+```
213
+MAIL_METHOD=smtp
214
+
215
+SMTP_SERVER=email.example.com
216
+SMTP_USER=coolskeleton95
217
+SMTP_PASS=aardbei123
218
+```
219
+
220
+# Create an Admin person
221
+If you're not me, you'll want to create your own user. Run:
222
+
223
+```console
224
+$ rails console
225
+> p = Person.new
226
+> p.first_name = 'Maarten'
227
+> p.infix = 'van den'
228
+> p.last_name = 'Berg'
229
+> p.email = 'youremail@example.com'
230
+> p.is_admin = 1
231
+> p.save
232
+> exit
233
+```
234
+
235
+Note that this has not yet set a password for you: to do that, we need to run a server.
236
+
237
+# Running the server directly / in development mode
238
+To start the server, run the command `rails server`. Your terminal will block
239
+until you press Control-C. In addition to this, you will need to be running the
240
+jobs worker to be able to send emails. To start it, run (in another terminal or
241
+before starting the server) `bin/delayed_job start` (or run in the foreground
242
+with `bin/delayed_job run`).
243
+
244
+# Running in production
245
+TODO.
246
+
247
+# Activating your admin user
248
+To activate your admin user, have your server running and go to
249
+`http://localhost:3000/register`. Enter the email address you entered when you
250
+created your Person, and follow the instructions.
251
+
252
+<!--* Deployment instructions-->
253
+
254
+[rbenv]: https://github.com/rbenv/rbenv
255
+[ruby-build]: https://github.com/rbenv/ruby-build
256
+[rbenv-vars]: https://github.com/rbenv/rbenv-vars
257
+[Git]: https://git-scm.com
258
+[Mailgun]: https://mailgun.com

+ 21 - 0
LICENSE.md

@@ -0,0 +1,21 @@
1
+MIT License
2
+
3
+Copyright (c) 2017 Maarten van den Berg
4
+
5
+Permission is hereby granted, free of charge, to any person obtaining a copy
6
+of this software and associated documentation files (the "Software"), to deal
7
+in the Software without restriction, including without limitation the rights
8
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+copies of the Software, and to permit persons to whom the Software is
10
+furnished to do so, subject to the following conditions:
11
+
12
+The above copyright notice and this permission notice shall be included in all
13
+copies or substantial portions of the Software.
14
+
15
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+SOFTWARE.

+ 18 - 18
README.md

@@ -1,24 +1,24 @@
1
-# README
1
+# Aardbei, "sprankelprachtig aan- en afmeldsysteem"
2 2
 
3
-This README would normally document whatever steps are necessary to get the
4
-application up and running.
3
+Aardbei is a tool meant to simplify signing up for many activities organized
4
+within the same group of people.
5
+The organizers of the activities can set when the activity starts and ends,
6
+a description and location, and can set a deadline for signing up after which
7
+only the organizers can change the information, and remind people who haven't
8
+responded yet automatically at a set time.
5 9
 
6
-Things you may want to cover:
10
+Planned features:
7 11
 
8
-* Ruby version
12
+* Random distribution of participants of an activity into subgroups
13
+* Automatic information email to organizers of activities
9 14
 
10
-* System dependencies
15
+# Screenshots
16
+See [here][screenshots]. The screenshots show the two main views: the
17
+dashboard, showing an overview of the user's activities, and the detail view for
18
+an activity.
11 19
 
12
-* Configuration
20
+# Installing
21
+See [the install guide][installing].
13 22
 
14
-* Database creation
15
-
16
-* Database initialization
17
-
18
-* How to run the test suite
19
-
20
-* Services (job queues, cache servers, search engines, etc.)
21
-
22
-* Deployment instructions
23
-
24
-* ...
23
+[screenshots]: doc/screenshots/
24
+[installing]: INSTALLING.md

BIN
doc/screenshots/activity-desktop.png


BIN
doc/screenshots/activity-mobile.png


BIN
doc/screenshots/dashboard-desktop.png


BIN
doc/screenshots/dashboard-mobile.png