@@ -86,6 +86,95 @@ having to change any configuration files.
8686
8787 bundle install --deployment
8888
89+ ## Set up database
90+
91+ Switch over to the ` postgres ` user:
92+
93+ sudo su - postgres
94+
95+ Create a postgres user to own the database:
96+
97+ createuser tess_user
98+
99+ Open up the postgres console:
100+
101+ psql
102+
103+ In the postgres console, set a password for the user:
104+
105+ postgres=# \password tess_user
106+
107+ ...and grant it a privilege to create databases:_
108+
109+ postgres=# ALTER USER tess_user CREATEDB;
110+
111+ ## Install Solr
112+
113+ TeSS uses Apache Solr to power its search and filtering system.
114+
115+ Double check you are using Java 11:
116+
117+ java -version
118+
119+ If not, you can switch using the following command:
120+
121+ sudo update-alternatives --config java
122+
123+ Run the following commands to download and install solr into /opt/, and have it run as a service that will start on boot.
124+
125+ cd /opt
126+ sudo wget https://downloads.apache.org/lucene/solr/8.11.2/solr-8.11.2.tgz
127+ sudo tar xzf solr-8.11.2.tgz solr-8.11.2/bin/install_solr_service.sh --strip-components=2
128+ sudo bash ./install_solr_service.sh solr-8.11.2.tgz
129+
130+ ### Starting/stopping solr
131+
132+ Make sure solr is started using:
133+
134+ sudo service solr start
135+
136+ If you need to stop it for whatever reason, run:
137+
138+ sudo service solr stop
139+
140+ By default, solr should be running at localhost:8983
141+
142+ ### Create a solr "collection"
143+
144+ Next, create a collection for TeSS to use (assuming TeSS is checked out at ` /home/tess/TeSS ` ):
145+
146+ sudo su - solr -c "/opt/solr/bin/solr create -c tess_production -d /home/tess/TeSS/solr/conf"
147+
148+ ` tess_production ` here is the collection name, which should match what is configured in your ` config/sunspot.yml `
149+ under the ` path ` parameter, following ` /solr/ ` .
150+
151+ ## Configure TeSS
152+
153+ Switch back to the ` tess ` user.
154+
155+ From the app's root directory, create several config files by copying the example files.
156+
157+ cp config/tess.example.yml config/tess.yml
158+ cp config/sunspot.example.yml config/sunspot.yml
159+ cp config/secrets.example.yml config/secrets.yml
160+ cp config/ingestion.example.yml config/ingestion.yml
161+
162+ Edit config/secrets.yml to configure the database user and password defined above.
163+
164+ Edit config/secrets.yml to configure the app's secret_key_base which you can generate with:
165+
166+ bundle exec rake secret
167+
168+ Create the databases:
169+
170+ RAILS_ENV=production bundle exec rake db:create
171+
172+ Create the database structure and load in seed data:
173+
174+ _ Note: Ensure you have started Solr before running this command!_
175+
176+ RAILS_ENV=production bundle exec rake db:setup
177+
89178## Compile assets
90179
91180Assets - such as images, javascript and stylesheets, need to be precompiled -
@@ -157,46 +246,6 @@ We would strongly recommend using [Lets Encrypt](https://letsencrypt.org/) for f
157246Certbot is a commandline tool can be used to request an SSL certificate and automatically configure Apache.
158247[ See this guide for more information] ( https://certbot.eff.org/instructions?ws=apache&os=ubuntufocal ) .
159248
160- ## Install Solr
161-
162- TeSS uses Apache Solr to power its search and filtering system.
163-
164- Double check you are using Java 11:
165-
166- java -version
167-
168- If not, you can switch using the following command:
169-
170- sudo update-alternatives --config java
171-
172- Run the following commands to download and install solr into /opt/, and have it run as a service that will start on boot.
173-
174- cd /opt
175- sudo wget https://downloads.apache.org/lucene/solr/8.11.2/solr-8.11.2.tgz
176- sudo tar xzf solr-8.11.2.tgz solr-8.11.2/bin/install_solr_service.sh --strip-components=2
177- sudo bash ./install_solr_service.sh solr-8.11.2.tgz
178-
179- ### Starting/stopping solr
180-
181- Make sure solr is started using:
182-
183- sudo service solr start
184-
185- If you need to stop it for whatever reason, run:
186-
187- sudo service solr stop
188-
189- By default, solr should be running at localhost:8983
190-
191- ### Create a "collection"
192-
193- Next, create a collection for TeSS to use (assuming TeSS is checked out at ` /home/tess/TeSS ` ):
194-
195- sudo su - solr -c "/opt/solr/bin/solr create -c tess_production -d /home/tess/TeSS/solr/conf"
196-
197- ` tess_production ` here is the collection name, which should match what is configured in your ` config/sunspot.yml `
198- under the ` path ` parameter, following ` /solr/ ` .
199-
200249## Configure Sidekiq
201250
202251Sidekiq, which runs asynchronous tasks in TeSS, needs to be configured to run as a service.
@@ -222,7 +271,7 @@ they are set on login, use the following commands:
222271
223272and then restart your SSH/su session.
224273
225- You should then be able to enable the Sidekiq service:
274+ You should then be able to enable the Sidekiq service (as the ` tess ` user) :
226275
227276 systemctl --user daemon-reload
228277 systemctl --user enable sidekiq.service
0 commit comments