heihachi88
10/25/2016 - 2:25 PM

Bitbucket server nginx and rest config / Mysql UTF8_BIN collate. Grant Mysql user all privileges || get 2nd ipv4 address || install haproxy

Bitbucket server nginx and rest config / Mysql UTF8_BIN collate. Grant Mysql user all privileges || get 2nd ipv4 address || install haproxy to redirect 22 port to 7999 then edit /etc/ssh/sshd_config to bind single ip for port 22 -> service sshd restart ||

# /etc/ssh/sshd_config

# Use these options to restrict which interfaces/protocols sshd will bind to
#ListenAddress ::
ListenAddress 185.37.146.40
# Open <Bitbucket_Installation_Directory>/bin/setenv.sh

#
# Occasionally Atlassian Support may recommend that you set some specific JVM arguments.  You can use this variable
# below to do that.
#
JVM_SUPPORT_RECOMMENDED_ARGS="-Djava.security.egd=file:/dev/./urandom"
# sudo vi /var/atlassian/application-data/bitbucket/shared/server.xml

<Connector port="7990" protocol="HTTP/1.1"
           connectionTimeout="20000"
           useBodyEncodingForURI="true"
           redirectPort="8443"
           compression="on"
           secure="true"
           scheme="https"
           proxyName="git.webium.me"
           proxyPort="443"
           compressableMimeType="text/html,text/xml,text/plain,text/css,application/json,application/javascript,application/x-javascript" />
server {
        listen 80;
        listen [::]:80;
        server_name git.webium.me;
        return 301 https://$server_name$request_uri;
}

server {
        listen 443 ssl;
        listen [::]:443 ssl;

        server_name git.webium.me;

        root /srv/www/git.webium.me;
        #index index.php index.html index.htm;

        ssl_certificate /etc/letsencrypt/live/git.webium.me/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/git.webium.me/privkey.pem;

        include snippets/ssl-params.conf;

        location / {
                proxy_set_header X-Forwarded-Host $host;
                proxy_set_header X-Forwarded-Server $host;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_pass http://localhost:7990;
                client_max_body_size 10M;

                # vs timeouts
                proxy_connect_timeout       600;
                proxy_send_timeout          600;
                proxy_read_timeout          600;
                send_timeout                600;
        }

       	location ~ /.well-known {
                allow all;
        }
}
defaults
        #option httplog
        option tcplog

frontend sshd
        mode tcp
        bind ip_address:22
        default_backend ssh
        timeout client 1h

backend ssh
        mode tcp
        server localhost-bitbucket-ssh 127.0.0.1:7999
# install new instance of bitbucket on a new machine and copy following folders from the old one to a new one
# stop atlbibucket
# copy files from old server to a new one
# import/export db and start atlbitbucket

/var/atlassian/application-data/bitbucket (all this directory needs to be backed up):

  bin/git-hooks
  shared
  
# https://confluence.atlassian.com/bitbucketserver/migrating-bitbucket-server-to-another-server-776640406.html