You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+77-18Lines changed: 77 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,24 +13,24 @@ Intercode is a web application that:
13
13
14
14
Intercode 2 was a ground-up rewrite of Intercode, making it more robust, more flexible, and more modern. Starting at version 3.0.0, we've used [semantic versioning](https://semver.org/) for our releases.
15
15
16
-
# Overall Architecture
16
+
##Overall Architecture
17
17
18
18
-**Backend**: Ruby on Rails application exposing a GraphQL API and an OpenID Connect-enabled OAuth2 server
19
19
-**Frontend**: React and Apollo-based single-page JavaScript app
20
20
-**Database engine**: PostgreSQL
21
21
-**Background queue system**: Amazon SQS + Shoryuken (this might change in the future)
22
22
-**Production infrastructure**: For [New England Interactive Literature](http://interactiveliterature.org)'s installation of Intercode, we're hosting it on [Fly](https://fly.io).
23
23
24
-
# Getting Started with Developing Intercode
24
+
##Getting Started with Developing Intercode
25
25
26
26
- Intercode in development mode uses `intercode.test` as its cookie domain. If you use `localhost` to visit the site, that will mysteriously fail. I'm going to try to make the site detect the wrong domain and redirect you, but for now, please just use the `intercode.test` domain name.
27
27
- We used to support a Docker Compose-based development workflow, but this has been deprecated. Please run Rails locally using the instructions below.
28
28
29
-
## Developer Setup with local Rails
29
+
###Developer Setup with local Rails
30
30
31
31
This is the classic Rails development setup, and should work for Mac and Linux users. Windows users should use WSL.
32
32
33
-
### Dev tooling setup using mise
33
+
####Dev tooling setup using mise
34
34
35
35
In this tutorial, we're going to set up [mise-en-place](https://mise.jdx.dev) to manage the versions of Ruby and Node.js used to run Intercode. This will be a globally-installed tool on your system, so if you don't want to do it this way, know that there are other options such as [rbenv](https://github.com/sstephenson/rbenv#readme).
36
36
@@ -58,12 +58,12 @@ mise settings ruby.compile=false
58
58
59
59
(The last one isn't strictly necessary but it should save a lot of time on the installation.)
60
60
61
-
### Setting up other dependencies
61
+
####Setting up other dependencies
62
62
63
63
On Linux and WSL, you'll need to have a few packages installed before setting up Intercode. For Debian and Ubuntu, this command should do it:
On macOS, you should have [Homebrew](https://brew.sh/) installed. Homebrew will also guide you through installing the Xcode command line tools. Once that's done, run this:
@@ -94,7 +94,7 @@ psql postgres
94
94
95
95
This should let you into Postgres, this time as your local user account.
96
96
97
-
### Setting up Intercode
97
+
####Setting up Intercode
98
98
99
99
First, clone this repository:
100
100
@@ -123,6 +123,47 @@ corepack enable
123
123
yarn install
124
124
```
125
125
126
+
#### Setting up the database
127
+
128
+
In theory, it should be possible to set up your local database using this command:
129
+
130
+
```sh
131
+
bin/rails db:create db:migrate db:seed
132
+
```
133
+
134
+
There are a few things that can go wrong here. Let's go through some common types of errors and how you can fix them:
135
+
136
+
<details>
137
+
138
+
<summary>`PG::ConnectionBad: connection to server at "::1", port 5432 failed: fe_sendauth: no password supplied (PG::ConnectionBad)`</summary>
139
+
140
+
If you're seeing something like this, you probably need to force Rails to connect to the database server using a UNIX socket as opposed to trying to connect via localhost TCP port 5432. To do this, we'll need to change the `DATABASE_URL` environment variables. Start by copying these lines from `.env.development` into `.env.development.local`:
Then, add the path to the UNIX socket as a `?host=` parameter at the end of both URLs. On Debian, the path to the socket is `/var/run/postgresql`, so these lines would become:
If you're seeing something like this, you're probably running an older version of PostgreSQL than the one Intercode supports. We tend to track new PostgreSQL releases pretty closely, so you probably
161
+
need the latest version available.
162
+
163
+
</details>
164
+
165
+
#### Setting up weird web serving nonsense
166
+
126
167
Intercode uses a somewhat unfortunate custom setup for local HTTP. Because some features require HTTPS, we generate a self-signed CA and certificate. In addition, Intercode expects to have different domain names for each convention it hosts, so we set up \*.intercode.test as a private fake DNS namespace for the local copy of Intercode to use.
127
168
128
169
First, let's generate the self-signed certificates:
@@ -136,18 +177,23 @@ On macOS, the above command will prompt for your password and install the CA in
136
177
137
178
Now, let's set up the private DNS namespace. The setup for this differs somewhat between different operating systems:
138
179
139
-
#### macOS
180
+
<details>
181
+
<summary>macOS</summary>
140
182
141
183
On macOS, create a file called `/etc/resolver/intercode.test` with the following contents:
142
184
143
-
```
185
+
```text
144
186
domain intercode.test
145
187
nameserver 127.0.0.1
146
188
```
147
189
148
190
To test that this is working, try running `ping randomname.intercode.test`. It should start pinging your local machine on 127.0.0.1.
149
191
150
-
#### Linux
192
+
</details>
193
+
194
+
<details>
195
+
196
+
<summary>Linux</summary>
151
197
152
198
On Linux, there's no built-in way to do wildcard domain resolution like there is with macOS's resolver. But, we can use dnsmasq as a DNS resolver proxy and configure it to resolve \*.intercode.test to 127.0.0.1. First, install dnsmasq:
153
199
@@ -157,20 +203,20 @@ sudo apt install dnsmasq
157
203
158
204
Then create a file called `/etc/dnsmasq.d/dnsmasq-intercode.conf` with the following contents:
159
205
160
-
```
206
+
```text
161
207
address=/intercode.test/127.0.0.1
162
208
```
163
209
164
210
Now we need to get dnsmasq to play nice with systemd, which at least in Debian's setup, it won't do by default. First, edit `/etc/dnsmasq.conf` and add these lines:
165
211
166
-
```
212
+
```text
167
213
listen-address=127.0.0.2
168
214
bind-interfaces
169
215
```
170
216
171
217
This will make dnsmasq listen on 127.0.0.2, which won't conflict with systemd-resolved. We also need to get it to stop trying to listen on 127.0.0.1. To do that, edit `/etc/default/dnsmasq` and find the commented-out line that says `DNSMASQ_EXCEPT="lo"`. Uncomment it:
To test that this is working, try running `ping randomname.intercode.test`. It should start pinging your local machine on 127.0.0.1.
196
242
197
-
### Starting Intercode for the first time
243
+
</details>
244
+
245
+
<details>
246
+
<summary>Windows</summary>
247
+
248
+
On Windows, there's no built-in way to do wildcard domain resolution like there is with macOS's resolver. But, we can use a DNS resolver proxy such as [Acrylic](https://mayakron.altervista.org/support/acrylic/Home.htm) and configure it to resolve \*.intercode.test to 127.0.0.1.
249
+
250
+
I have not personally tried this, but if someone does and would like to contribute instructions to this README, I would be forever grateful!
251
+
252
+
<3, Nat
253
+
254
+
</details>
255
+
256
+
#### Starting Intercode for the first time
198
257
199
258
You'll need two terminals (or two terminal tabs) for this. In the first, start up the Rails backend server:
200
259
@@ -236,17 +295,17 @@ If you want to test how the app runs in production, but using your local develop
236
295
4. Run something like the following command, changing the asset host as necessary for your setup: `docker run -it -p 5051:3000 -e DATABASE_URL=postgresql://postgres@docker.for.mac.localhost/intercode_development -e RAILS_LOG_TO_STDOUT=true -e ASSETS_HOST=//intercont.intercode.test:5050 -e RAILS_SERVE_STATIC_FILES=true local-intercode-production bin/rails`
237
296
5. Visit <https://some-convention-domain.intercode.test:5050>, probably using Firefox (it seems to deal better than Chrome with self-signed certificates these days).
238
297
239
-
# Contacting us
298
+
##Contacting us
240
299
241
300
To contact the Intercode project team, you can:
242
301
243
302
-[File an issue or feature request here](https://github.com/neinteractiveliterature/intercode/issues)
244
303
-[Email Nat Budin](mailto:natbudin@gmail.com).
245
304
246
-
# Code of Conduct
305
+
##Code of Conduct
247
306
248
307
Participants in the Intercode project are expected to follow the Contributor Covenant. For details, [see CODE_OF_CONDUCT.md](https://github.com/neinteractiveliterature/intercode/blob/main/CODE_OF_CONDUCT.md).
249
308
250
-
# License
309
+
##License
251
310
252
311
Intercode is released under the terms and conditions of the MIT license. Please see the LICENSE file for the full legalese.
CONSTRAINT bucket_key_null_for_non_slot_occupying_states CHECK (((bucket_key IS NULL) OR ((state)::text= ANY ((ARRAY['confirmed'::character varying, 'ticket_purchase_hold'::character varying])::text[]))))
2711
+
CONSTRAINT bucket_key_null_for_non_slot_occupying_states CHECK (((bucket_key IS NULL) OR ((state)::text= ANY (ARRAY[('confirmed'::character varying)::text, ('ticket_purchase_hold'::character varying)::text]))))
0 commit comments