This commit is contained in:
edshot99 2024-11-07 22:35:51 -05:00
parent 40681b4a0e
commit dbffa01c30

View File

@ -11,20 +11,14 @@ The first step you will need to take is to install the following packages:
# pkg_add ffmpeg libvips
```
Package Notes:
iqdb and autocompleted will need to be compiled on your own for the time being.
You can find the port files at this repository: https://git.groovyexpress.com/edshot99/OpenBSD-Unofficial-Ports
With OpenBSD 7.6 there will compilation problems with autocompleted. You can install an older Rust compiler from OpenBSD 7.5 to get around this.
You can find the iqdb and autocompleted packages here:
https://git.groovyexpress.com/edshot99/OpenBSD-Unofficial-Ports/releases
OpenBSD 7.6 uses a new version of libgit2 that is incompatible with the Ruby rugged gem. This will also require compiling an older version of libgit2 if you are using OpenBSD 7.6
Lastly, libvips is currently compiled with a lot of features disabled. One of these features being ICC support which causes problem with e621ng.
This will also require a recompile with lcms2 support enabled.
This is quite cumbersome to deal with, but will eventually be taken care of to make installation easier.
You will also want to install libgit2 and libvips from this page too as an older version of libgit2 is required for the Ruby rugged gem and libvips with ICC support is required for e621ng.
## PostgreSQL
You can follow the guide at /usr/local/share/doc/pkg-readmes/postgresql on setting up PostgreSQL.
Once you have PostgreSQL set up you can set up the e621 account as follows:
```
CREATE ROLE e621 WITH CREATEDB LOGIN PASSWORD 'XXX';
@ -32,9 +26,10 @@ CREATE ROLE e621 WITH CREATEDB LOGIN PASSWORD 'XXX';
## OpenSearch
You can follow the guide at /usr/local/share/doc/pkg-readmes/opensearch on tuning your system for OpenSearch.
Don't follow the 'Initial Node/Cluster Configuration' section. e621ng will not be needing the OpenSearch security plugin.
Once finished tuning your system, you can then edit your /etc/opensearch/opensearch.yml configuration to something like this:
Once finished tuning your system you can then edit your /etc/opensearch/opensearch.yml configuration to something like this:
```
cluster.name: e621ng
node.name: node-1
@ -67,22 +62,16 @@ Once configuration is complete you can then enable nginx, start nginx, and reque
Note: You will need to temporarily disable ssl_* options in your nginx file so nginx can start properly.
### Redis / memcached / iqdb / autocompleted
## Redis / memcached / iqdb / autocompleted
Only autocompleted needs configuring which can be done with the /etc/autocompleted.env file.
Once configured you can then enable and start all these daemons:
```
# rcctl enable redis
# rcctl start redis
# rcctl enable memcached
# rcctl start memcached
# rcctl enable iqdb
# rcctl start iqdb
# rcctl enable autocompleted
# rcctl start autocompleted
# rcctl enable redis memcached iqdb autocompleted
# rcctl start redis memcached iqdb autocompleted
```
By default, the iqdb database is stored at /var/db/iqdb/e621_v2.db and can be configured by setting daemon flags.
By default the iqdb database is stored at /var/db/iqdb/e621_v2.db and can be configured by setting daemon flags.
## e621ng - Part One - System Account
You can start by creating a dedicated user for running the software:
@ -146,7 +135,7 @@ $ chmod 400 .danbooru/secret_token .danbooru/session_secret_key
$ chmod 640 .danbooru/danbooru_local_config.rb
```
You can then edit content_security_policy.rb and danbooru_local_config.rb for your needs.
You can then edit content_security_policy.rb and danbooru_local_config.rb to your needs.
The .danbooru/secret_token and .danbooru/session_secret_key don't necessarily have to be files and can be stored in the .env file, but I just prefer to do it this way.
Once you have finished configuration you can then set up the .env file which is needed for Rails production mode:
@ -166,28 +155,31 @@ DB_WORKER_POOL_SIZE=10
DB_POOL_SIZE=10
```
Note: If you are planning to development you will have to modify config/databases.yml instead.
Note: If you are planning to do development you do not have to set up a .env file and will have to modify config/databases.yml instead.
## e621ng - Part Four - Starting
Load the configuration files into the e621ng folder:
```
$ cd e621ng
$ ln -s /var/e621ng/.env .
$ ln -s /var/e621ng/.danbooru/danbooru_local_config.rb e621ng/danbooru_local_config.rb
$ ln -sf /var/e621ng/.danbooru/content_security_policy.rb e621ng/config/initializers/content_security_policy.rb
$ ln -s /var/e621ng/.danbooru/danbooru_local_config.rb config/danbooru_local_config.rb
$ ln -sf /var/e621ng/.danbooru/content_security_policy.rb config/initializers/content_security_policy.rb
```
Modify the db/seeds.rb file to modify the admin account name and password and the auto_moderator account password.
You can also modify what forum categories are created and disable default e621 mascot and whitelist creation.
Once this is done you can then initialize opensearch indices, the database, the webpack and then start the software:
Once this is done you can then initialize the OpenSearch indices, the e621 PostgreSQL database, the webpack and then start the software:
```
RAILS_ENV=production ./bin/rails runner '[Post, PostVersion].each { |model| model.document_store.create_index! }'
RAILS_ENV=production ./bin/rails db:create
RAILS_ENV=production ./bin/rails db:schema:load
RAILS_ENV=production ./bin/rails db:seed
./node_modules/.bin/webpack -c config/webpack/production.js
~/.local/share/gem/ruby/3.3/bin/foreman33 start
$ RAILS_ENV=production ./bin/rails runner '[Post, PostVersion].each { |model| model.document_store.create_index! }'
$ RAILS_ENV=production ./bin/rails db:create
$ RAILS_ENV=production ./bin/rails db:schema:load
$ RAILS_ENV=production ./bin/rails db:seed
$ mv public /var/www/e621ng/public-packs
$ ln -s /var/www/e621ng/public-packs public
$ ./node_modules/.bin/webpack -c config/webpack/production.js
$ ~/.local/share/gem/ruby/3.3/bin/foreman33 start
```
Note: Running webpack is not requried when running in developemnt mode.
@ -196,3 +188,21 @@ You should now be able to access the website through nginx now.
If everything is working you can also do a 'git restore db/seeds.rb' file to restore the original file.
If something is not working you should check the log/production.log file for what is wrong.
## Cron
The cron process in the Procfile has been disabled since it will not work on OpenBSD.
To get it working again you will have to copy and modify the daily_maintenance.sh script:
```
$ cd ~/
$ cp -av e621ng/docker/cron_tasks/daily/daily_maintenance.sh .
$ vi daily_maintenance.sh
```
and change '/app' to '~/e621ng' when editing the file.
You can log out of the e621ng account and then as root edit the /etc/daily.local file to add something like:
```
next_part "Running e621ng daily maintenance:"
/usr/bin/su -l -s /bin/ksh e621ng /var/e621ng/daily_maintenance.sh >/dev/null 2>&1
```