summarylogtreecommitdiffstats
path: root/sentry.install
blob: 4dfd7cd9da2bfa04c5397ea0ef6824d43cd3c200 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
post_install(){

    /usr/sbin/useradd -s /bin/false -d /opt/sentry -r sentry

    /usr/bin/chown -R root:root /opt/sentry
    /usr/bin/chown -R sentry:sentry /opt/sentry/.python-eggs
    /usr/bin/chown -R sentry:sentry /etc/sentry

    # Storage location for Celery's database.
    /usr/bin/mkdir -p /opt/sentry/celery
    /usr/bin/chown sentry:sentry /opt/sentry/celery

    # Generate a new configuration.
    if [ ! -e "/etc/sentry/sentry.conf.py" ] ; then
        "/opt/sentry/bin/sentry" init "/etc/sentry/sentry.conf.py"
    fi

    /usr/bin/chmod 0600 /etc/sentry/sentry.conf.py

cat << EOF

INSTALLATION STEPS

1) Initialize Sentry's configuration:

    sudo -u sentry PATH=/opt/sentry/bin:\$PATH \\
        /opt/sentry/bin/sentry init /etc/sentry

Be sure to edit the configurations in /etc/sentry before proceeding to the next
step.

2) Install the appropriate database packages for your setup:

    # MySQL
    sudo -u sentry -- /usr/bin/bash -c \\
    'source /opt/sentry/bin/activate && /opt/sentry/bin/pip install mysql-python'

    # PostgreSQL
    sudo -u sentry -- /usr/bin/bash -c \\
    'source /opt/sentry/bin/activate && /opt/sentry/bin/pip install psycopg2'

3) Run migrations:

    sudo -u sentry PATH=/opt/sentry/bin:\$PATH \\
        /opt/sentry/bin/sentry --config=/etc/sentry/sentry.conf.py upgrade

4) Create the initial superuser:

    sudo -u sentry PATH=/opt/sentry/bin:\$PATH \\
        /opt/sentry/bin/sentry --config=/etc/sentry/sentry.conf.py createuser

5) Start Sentry:

    sudo systemctl start sentry sentry-celery

If you wish to run Sentry manually, e.g. to test your configuration:

    sudo -u sentry PATH=/opt/sentry/bin:\$PATH \\
        --config=/etc/sentry/sentry.conf.py start

EXTRAS

To install additional plugins, you'll need to use Sentry's local copy of pip:

    sudo -u sentry PATH=/opt/sentry/bin:\$PATH \\
        /opt/sentry/bin/pip install <package>

REMOVAL

As of Sentry 7.1.4, this package will no longer remove the Sentry user by
default. You must perform this step manually.

THANKS

I appreciate the tips and suggestions I've received since converting this
package to a (mostly) pure virtualenv installation. Please report any issues
related to the PKGBUILD on the AUR page or open a ticket on my Github
project page:

https://aur.archlinux.org/packages/sentry/
https://github.com/zancarius/archlinux-pkgbuilds

EOF
}

post_upgrade(){

    /usr/bin/chown -R root:root /opt/sentry
    /usr/bin/chown -R sentry:sentry /etc/sentry
    /usr/bin/chown -R sentry:sentry /opt/sentry/.python-eggs

    # Storage location for Celery's database.
    /usr/bin/mkdir -p /opt/sentry/celery
    /usr/bin/chown sentry:sentry /opt/sentry/celery

    /usr/bin/chmod 0600 /etc/sentry/sentry.conf.py

cat << EOF

UPGRADE STEPS

1) Stop Sentry and its related services (and reload systemd)

    sudo systemctl stop sentry sentry-celery
    sudo systemctl --system daemon-reload

2) If you're upgrading from a Sentry version < 8.0, you'll need to update the
configuration by hand. Sentry's configuration setup has changed dramatically:

    sudo -u sentry mkdir /etc/sentry/temp
    sudo -u sentry /opt/sentry/bin/sentry init /etc/sentry/temp

    # Optionally edit the old configuration:
    sudo vimdiff /etc/sentry/sentry.conf.py /etc/sentry/temp/sentry.conf.py

    # Move Sentry's YAML configuration to the config root:
    sudo -u sentry mv /etc/sentry/temp/config.yml /etc/sentry/

    # Delete the temporary config directory:
    sudo rm -r /etc/sentry/temp

3) Install the appropriate drivers if you don't already have them (you may skip
this step if you do):

    # MySQL
    sudo -u sentry -- /usr/bin/bash -c \\
    'source /opt/sentry/bin/activate && /opt/sentry/bin/pip install mysql-python'

    # PostgreSQL
    sudo -u sentry -- /usr/bin/bash -c \\
    'source /opt/sentry/bin/activate && /opt/sentry/bin/pip install psycopg2'

4) Run the database migrations:

!!! ALWAYS BACK-UP YOUR DATABASE PRIOR TO UPGRADING SENTRY !!!

    sudo -u sentry PATH=/opt/sentry/bin:\$PATH \\
        /opt/sentry/bin/sentry --config=/etc/sentry/sentry.conf.py upgrade

5) Start Sentry:

    sudo systemctl start sentry sentry-celery

If you wish to run Sentry manually, e.g. to test your configuration:

    sudo -u sentry PATH=/opt/sentry/bin:\$PATH \\
        --config=/etc/sentry/sentry.conf.py start

EXTRAS

To install additional plugins, you'll need to use Sentry's local copy of pip:

    sudo -u sentry PATH=/opt/sentry/bin:\$PATH \\
        /opt/sentry/bin/pip install <package>

REMOVAL

As of Sentry 7.1.4, this package will no longer remove the Sentry user by
default. You must perform this step manually.

SENTRY WON'T START?

Recent versions of Sentry included a configuration for specifying large integers
for certain ID columns, most notably sentry_project.id. If your migrations fail
and SENTRY_USE_BIG_INTS is enabled, try disabling it and restart the migration.
While this is unlikely to bite you unless you've migrated from a much earlier
version of Sentry (version 6 or early 7), it is one of the most likely blockers
that may prevent you from updating.

THANKS

I appreciate the tips and suggestions I've received since converting this
package to a (mostly) pure virtualenv installation. Please report any issues
related to the PKGBUILD on the AUR page or open a ticket on my Github
project page:

https://aur.archlinux.org/packages/sentry/
https://github.com/zancarius/archlinux-pkgbuilds

EOF

}