mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 14:03:30 +00:00 
			
		
		
		
	Add support for running OpenBSD in development environment.
This commit is contained in:
		
				
					committed by
					
						
						Tim Abbott
					
				
			
			
				
	
			
			
			
						parent
						
							84f7a1f1ea
						
					
				
				
					commit
					dfbea01c8f
				
			@@ -204,6 +204,35 @@ host    all             all             ::1/128                 md5
 | 
			
		||||
 | 
			
		||||
Now continue with the Common to Fedora/CentOS instructions below.
 | 
			
		||||
 | 
			
		||||
### On OpenBSD 5.8 (experimental):
 | 
			
		||||
 | 
			
		||||
These instructions are experimental and may have bugs; patches welcome!
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
doas pkg_add sudo bash gcc postgresql-server redis rabbitmq memcached node libmemcached py-Pillow py-cryptography py-cffi
 | 
			
		||||
 | 
			
		||||
# Get tsearch_extras and build it (using a modified version which aliases int4 on OpenBSD):
 | 
			
		||||
git clone https://github.com/blablacio/tsearch_extras
 | 
			
		||||
cd tsearch_extras
 | 
			
		||||
gmake && sudo gmake install
 | 
			
		||||
 | 
			
		||||
# Point environment to custom include locations and use newer GCC (needed for Node modules):
 | 
			
		||||
export CFLAGS="-I/usr/local/include -I/usr/local/include/sasl"
 | 
			
		||||
export CXX=eg++
 | 
			
		||||
 | 
			
		||||
# Create tsearch_data directory:
 | 
			
		||||
sudo mkdir /usr/local/share/postgresql/tsearch_data
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Hack around missing dictionary files -- need to fix this to get
 | 
			
		||||
# the proper dictionaries from what in debian is the hunspell-en-us package.
 | 
			
		||||
sudo touch /usr/local/share/postgresql/tsearch_data/english.stop
 | 
			
		||||
sudo touch /usr/local/share/postgresql/tsearch_data/en_us.dict
 | 
			
		||||
sudo touch /usr/local/share/postgresql/tsearch_data/en_us.affix
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Now continue with the All Systems instructions below.
 | 
			
		||||
 | 
			
		||||
### Common to Fedora/CentOS instructions
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
@@ -243,7 +272,7 @@ npm install
 | 
			
		||||
./tools/download-zxcvbn
 | 
			
		||||
./tools/emoji_dump/build_emoji
 | 
			
		||||
./scripts/setup/generate_secrets.py -d
 | 
			
		||||
sudo cp ./puppet/zulip/files/postgresql/zulip_english.stop /usr/share/postgresql/9.3/tsearch_data/
 | 
			
		||||
if [ $(uname) = "OpenBSD" ]; then sudo cp ./puppet/zulip/files/postgresql/zulip_english.stop /var/postgresql/tsearch_data/; else sudo cp ./puppet/zulip/files/postgresql/zulip_english.stop /usr/share/postgresql/9.3/tsearch_data/; fi
 | 
			
		||||
./scripts/setup/configure-rabbitmq
 | 
			
		||||
./tools/postgres-init-dev-db
 | 
			
		||||
./tools/do-destroy-rebuild-database
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
#!/bin/bash -e
 | 
			
		||||
#!/usr/bin/env bash
 | 
			
		||||
set -e
 | 
			
		||||
 | 
			
		||||
queue=$1
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
#!/bin/bash -xe
 | 
			
		||||
#!/usr/bin/env bash
 | 
			
		||||
set -xe
 | 
			
		||||
 | 
			
		||||
# Assumes we've already been untarred
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,9 @@
 | 
			
		||||
#!/bin/sh -xe
 | 
			
		||||
#!/usr/bin/env bash
 | 
			
		||||
#
 | 
			
		||||
# Delete the "guest" default user and replace it with a Zulip user
 | 
			
		||||
# with a real password
 | 
			
		||||
set -e
 | 
			
		||||
set -x
 | 
			
		||||
 | 
			
		||||
RABBITMQ_USERNAME=$("$(dirname "$0")/../../bin/get-django-setting" RABBITMQ_USERNAME)
 | 
			
		||||
RABBITMQ_PASSWORD=$("$(dirname "$0")/../../bin/get-django-setting" RABBITMQ_PASSWORD)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,6 @@
 | 
			
		||||
#!/bin/sh -xe
 | 
			
		||||
#!/usr/bin/env bash
 | 
			
		||||
set -e
 | 
			
		||||
set -x
 | 
			
		||||
 | 
			
		||||
# Flush memcached
 | 
			
		||||
echo 'flush_all' | nc localhost 11211
 | 
			
		||||
echo 'flush_all' | nc -w 0 localhost 11211
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
#!/bin/bash -xe
 | 
			
		||||
#!/usr/bin/env bash
 | 
			
		||||
set -xe
 | 
			
		||||
 | 
			
		||||
# Change to root directory of the checkout that we're running from
 | 
			
		||||
cd "$(dirname "$0")/../.."
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
#!/usr/bin/env bash
 | 
			
		||||
set -e
 | 
			
		||||
set -x
 | 
			
		||||
 | 
			
		||||
@@ -6,9 +6,14 @@ vergte() {
 | 
			
		||||
    [ "$1" = "`echo -e "$1\n$2" | sort -V | tail -n1`" ]
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
DEFAULT_USER="postgres"
 | 
			
		||||
if [ "$(uname)" = "OpenBSD" ]; then
 | 
			
		||||
  DEFAULT_USER="_postgresql"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
cd /
 | 
			
		||||
if [ "$EUID" -eq 0 ]; then
 | 
			
		||||
    version=$(su postgres -c 'psql -A -t -d postgres -c "show server_version"')
 | 
			
		||||
    version=$(sudo -u "$DEFAULT_USER"  sh -c 'psql -A -t -d postgres -c "show server_version"')
 | 
			
		||||
else
 | 
			
		||||
    version=$(psql -A -t -d postgres -c "show server_version")
 | 
			
		||||
fi
 | 
			
		||||
@@ -25,7 +30,7 @@ else
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
if [ "$EUID" -eq 0 ]; then
 | 
			
		||||
    su postgres -c psql postgres postgres <<EOF
 | 
			
		||||
    sudo -u "$DEFAULT_USER" sh -c 'psql postgres "$DEFAULT_USER"' <<EOF
 | 
			
		||||
SELECT pg_terminate_backend($pidname) FROM pg_stat_activity WHERE datname IN ($tables);
 | 
			
		||||
EOF
 | 
			
		||||
else
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
#!/bin/sh -x
 | 
			
		||||
#!/usr/bin/env bash
 | 
			
		||||
set -x
 | 
			
		||||
 | 
			
		||||
cd api/
 | 
			
		||||
# Strip out non-send_message bindings.
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,6 @@
 | 
			
		||||
#!/bin/sh -ex
 | 
			
		||||
#!/usr/bin/env bash
 | 
			
		||||
set -e
 | 
			
		||||
set -x
 | 
			
		||||
 | 
			
		||||
GITID=$(git rev-parse HEAD)
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
#!/bin/bash -e
 | 
			
		||||
#!/usr/bin/env bash
 | 
			
		||||
set -e
 | 
			
		||||
 | 
			
		||||
# Deletes any local branches which are ancestors of origin/master,
 | 
			
		||||
# and also any branches in origin which are ancestors of
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
#!/bin/bash -e
 | 
			
		||||
#!/usr/bin/env bash
 | 
			
		||||
set -e
 | 
			
		||||
 | 
			
		||||
# Remove .pyc files to prevent loading stale code.
 | 
			
		||||
#
 | 
			
		||||
@@ -8,4 +9,4 @@
 | 
			
		||||
#     chmod +x .git/hooks/post-checkout
 | 
			
		||||
 | 
			
		||||
cd "$(dirname "$0")/.."
 | 
			
		||||
find . -name '*.pyc' -delete
 | 
			
		||||
find . -name "*.pyc" -exec rm -f {} \;
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
#!/bin/bash -ex
 | 
			
		||||
#!/usr/bin/env bash
 | 
			
		||||
set -ex
 | 
			
		||||
 | 
			
		||||
cd /home/tabbott/zulip-backups
 | 
			
		||||
log="$(pwd)"/log
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
#!/bin/bash -xe
 | 
			
		||||
#!/usr/bin/env bash
 | 
			
		||||
set -xe
 | 
			
		||||
 | 
			
		||||
server=$1
 | 
			
		||||
type=$2
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
#!/bin/bash -e
 | 
			
		||||
#!/usr/bin/env bash
 | 
			
		||||
set -e
 | 
			
		||||
 | 
			
		||||
# Draws the Django template inheritance graph.
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,6 @@
 | 
			
		||||
#!/bin/sh -xe
 | 
			
		||||
#!/usr/bin/env bash
 | 
			
		||||
set -e
 | 
			
		||||
set -x
 | 
			
		||||
 | 
			
		||||
"$(dirname "$0")/../scripts/setup/terminate-psql-sessions" zulip zulip zulip_base
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,6 @@
 | 
			
		||||
#!/bin/sh -xe
 | 
			
		||||
#!/usr/bin/env bash
 | 
			
		||||
set -e
 | 
			
		||||
set -x
 | 
			
		||||
 | 
			
		||||
# This is a really simple wrapper script, pretty much for documenting clarity
 | 
			
		||||
"`dirname "$0"`/../tools/generate-fixtures" --force
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,6 @@
 | 
			
		||||
#!/bin/sh -ex
 | 
			
		||||
#!/usr/bin/env bash
 | 
			
		||||
set -e
 | 
			
		||||
set -x
 | 
			
		||||
 | 
			
		||||
mkdir -p static/third/zxcvbn/
 | 
			
		||||
wget https://raw.githubusercontent.com/dropbox/zxcvbn/0890678ede1488ecb02cda7eb793cd308a59c49d/zxcvbn.js -O static/third/zxcvbn/zxcvbn.js
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,9 @@
 | 
			
		||||
#!/bin/sh -ex
 | 
			
		||||
#!/usr/bin/env bash
 | 
			
		||||
set -e
 | 
			
		||||
set -x
 | 
			
		||||
 | 
			
		||||
rm -rf static/third/gemoji/images
 | 
			
		||||
(cd tools/emoji_dump && python ./emoji_dump.py)
 | 
			
		||||
mkdir -p static/third/gemoji/images
 | 
			
		||||
mv tools/emoji_dump/out static/third/gemoji/images/emoji
 | 
			
		||||
cp -a assets/zulip-emoji/* static/third/gemoji/images/emoji/
 | 
			
		||||
cp -RPp assets/zulip-emoji/* static/third/gemoji/images/emoji/
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
#!/bin/bash -e
 | 
			
		||||
#!/usr/bin/env bash
 | 
			
		||||
set -e
 | 
			
		||||
 | 
			
		||||
function migration_status {
 | 
			
		||||
    ./manage.py migrate --list --settings=zproject.test_settings | sed 's/*/ /' > "$1"
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
#!/bin/bash -e
 | 
			
		||||
#!/usr/bin/env bash
 | 
			
		||||
set -e
 | 
			
		||||
 | 
			
		||||
cd "$(dirname "$0")"/..
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
#!/bin/bash -e
 | 
			
		||||
#!/usr/bin/env bash
 | 
			
		||||
set -e
 | 
			
		||||
 | 
			
		||||
# Wrapper for node which finds the right binary.
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,12 +1,23 @@
 | 
			
		||||
#!/bin/bash -xe
 | 
			
		||||
#!/usr/bin/env bash
 | 
			
		||||
set -x
 | 
			
		||||
set -e
 | 
			
		||||
 | 
			
		||||
ROOT_POSTGRES="sudo -u postgres psql"
 | 
			
		||||
DEFAULT_USER="postgres"
 | 
			
		||||
if [ "$(uname)" = "OpenBSD" ]; then
 | 
			
		||||
  DEFAULT_USER="_postgresql"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
ROOT_POSTGRES="sudo -u "$DEFAULT_USER" psql"
 | 
			
		||||
DEFAULT_DB=""
 | 
			
		||||
if [ "$(uname)" = "Darwin" ]; then
 | 
			
		||||
   ROOT_POSTGRES="psql"
 | 
			
		||||
   DEFAULT_DB="postgres"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
if [ "$(uname)" = "OpenBSD" ]; then
 | 
			
		||||
  DEFAULT_DB="postgres"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
VAGRANTUSERNAME=$(whoami)
 | 
			
		||||
 | 
			
		||||
if [[ $# == 0 ]]; then
 | 
			
		||||
 
 | 
			
		||||
@@ -1,3 +1,5 @@
 | 
			
		||||
#!/bin/bash -xe
 | 
			
		||||
#!/usr/bin/env bash
 | 
			
		||||
set -x
 | 
			
		||||
set -e
 | 
			
		||||
 | 
			
		||||
"$(dirname "$0")/postgres-init-dev-db" zulip_test "$("$(dirname "$0")/../bin/get-django-setting" LOCAL_DATABASE_PASSWORD)" zulip_test zulip,public
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
#!/bin/bash -e
 | 
			
		||||
#!/usr/bin/env bash
 | 
			
		||||
set -e
 | 
			
		||||
 | 
			
		||||
cd "$(dirname "$0")"/..
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
#!/bin/bash -e
 | 
			
		||||
#!/usr/bin/env bash
 | 
			
		||||
set -e
 | 
			
		||||
 | 
			
		||||
target='zerver'
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
#!/bin/bash -e
 | 
			
		||||
#!/usr/bin/env bash
 | 
			
		||||
set -e
 | 
			
		||||
 | 
			
		||||
cd "$(dirname "$0")"/..
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user