User:Зелёный Кошак/Сервер OSM/Чек-листы/Развёртывание рейл-порта

From OpenStreetMap Wiki
Jump to navigation Jump to search
Чек Название операции Описание Процедуры Комментарии
mkdir <каталог для рейл-порта>

cd <каталог для рейл-порта>

git clone --depth=1 https://github.com/openstreetmap/openstreetmap-website.git

cd openstreetmap-website

bundle install

bundle exec rake yarn:install

touch config/settings.local.yml

cp config/example.storage.yml config/storage.yml
cp config/example.database.yml config/database.yml
<editor> config/settings.local.yml или <editor> config/settings.yml
<editor> config/database.yml

su - postgres или sudo -u postgres -i

createuser -s [-P] <db user>
exit

bundle exec rake db:create
su - postgres или sudo -u postgres -i

createdb -E UTF8 -O <db user> <production db>
exit

su - postgres или sudo -u postgres -i

psql
GRANT ALL PRIVILEGES on DATABASE <test db> to <db user>;
ALTER USER <db user> with CREATEDB;
alter role <db user> superuser;
\q
exit

su - postgres или sudo -u postgres -i

psql -d <developed db> -c "CREATE EXTENSION btree_gist"
psql -d <test db> -c "CREATE EXTENSION btree_gist"
[psql -d <production db> -c "CREATE EXTENSION btree_gist"]
cd <каталог для рейл-порта>/openstreetmap-website
psql -d <developed db> -f db/functions/functions.sql
[psql -d <production db> -f db/functions/functions.sql]
exit

cd db/functions

make libpgosm.so
cd ../..
su - postgres или sudo -u postgres -i
[psql -d <developed|production db> -c "DROP FUNCTION IF EXISTS maptile_for_point"]
[psql -d <developed|production db> -c "DROP FUNCTION IF EXISTS tile_for_point"]
[psql -d <developed|production db> -c "DROP FUNCTION IF EXISTS xid_to_int4"]
cd <каталог для рейл-порта>/openstreetmap-website
psql -d <developed|production db> -c "CREATE FUNCTION maptile_for_point(int8, int8, int4) RETURNS int4 AS '`pwd`/db/functions/libpgosm', 'maptile_for_point' LANGUAGE C STRICT"
psql -d <developed|production db> -c "CREATE FUNCTION tile_for_point(int4, int4) RETURNS int8 AS '`pwd`/db/functions/libpgosm', 'tile_for_point' LANGUAGE C STRICT"
psql -d <developed|production db> -c "CREATE FUNCTION xid_to_int4(xid) RETURNS int4 AS '`pwd`/db/functions/libpgosm', 'xid_to_int4' LANGUAGE C STRICT"
exit

bundle exec rake db:migrate
bundle exec rake test:db
bundle exec rails server [-p <port>]