forked from linkedin/oncall
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Py3 migration * Update to Python 3 for CircleCI * Fix auth bugs for python 3 Also fix notifier bug to check for active users * Update notifier exception handling Ignore role:target lookup failures from Iris, since these don't represent problems with the underlying system, just that people have inactive users on-call in the future. * Add get_id param option (linkedin#246) * add get_id param option * removed superfluous select and simplified logic * Flake8 typo (linkedin#247) * Hide confusing team settings in an advanced dropdown * Fix test fixtures * Add "allow duplicate" scheduler in UI Already in backend, so enable in FE too * Add Dockerfile to run oncall in a container * Move deps into a virtualenv. Run app not as super user. Mimick prod setup by using uwsgi * Fix issue with Dockerfile not having MANIFEST.in and wrong passwords in (linkedin#257) config * Update to ubuntu:18.04 and python3 packages and executables * Open config file as utf8 The default configuration file has utf8 characters, and python3 attempts to open the file as ASCII unless an alternate encoding is specified * Switch to the python3 uwsgi plugin * Update print and os.execv statements for python3 Python3 throws an exception when the first argument to os.execv is empty: ValueError: execv() arg 2 first element cannot be empty The module documentation suggests that the first element should be the name of the executed program: https://docs.python.org/3.7/library/os.html#os.execv * Map config.docker.yaml in to the container as a volume ./ops/entrypoint.py has the start of environment variable support to specify a configuration file, but it is incomplete until we update ./ops/daemons/uwsgi-docker.yaml or add environment support to oncall-notifier and oncall-scheduler. This commit allows users to map a specific configuration file in to their container and have it used by all oncall programs. * Convert line endings to match the rest of the project. * Add mysql port to docker configuration * Assume localhost mysql for default config.yaml * Update python-dev package and MySQL root password * Use password when configuring mysql The project has started using a password on the mysql instance. Once password auth is consistently working we can consider extracting the hardcoded password into an env file that is optionally randomly generated on initial startup. * Fix preview for round-robin (linkedin#269) * linkedin#275 fix for Python3 and Gunicorn load config * Fixed E303 flake8 * Change encoding & collation + test unicode name Co-authored-by: Daniel Wang <[email protected]> Co-authored-by: ahm3djafri <[email protected]> Co-authored-by: TK <[email protected]> Co-authored-by: Tim Freund <[email protected]> Co-authored-by: Rafał Zawadzki <[email protected]>
- Loading branch information
1 parent
b688b3c
commit af327b4
Showing
65 changed files
with
331 additions
and
164 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
#!/bin/bash | ||
|
||
for i in `seq 1 5`; do | ||
mysql -h 127.0.0.1 -u root -e 'show databases;' && break | ||
mysql -h 127.0.0.1 -u root --password=1234 -e 'show databases;' && break | ||
echo "[*] Waiting for mysql to start..." | ||
sleep 5 | ||
done | ||
|
||
echo "[*] Loading MySQL schema..." | ||
mysql -h 127.0.0.1 -u root < ./db/schema.v0.sql | ||
mysql -h 127.0.0.1 -u root --password=1234 < ./db/schema.v0.sql | ||
echo "[*] Loading MySQL dummy data..." | ||
mysql -h 127.0.0.1 -u root -o oncall < ./db/dummy_data.sql | ||
mysql -h 127.0.0.1 -u root --password=1234 -o oncall < ./db/dummy_data.sql | ||
|
||
echo "[*] Tables created for database oncall:" | ||
mysql -h 127.0.0.1 -u root -o oncall -e 'show tables;' | ||
mysql -h 127.0.0.1 -u root --password=1234 -o oncall -e 'show tables;' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
FROM ubuntu:18.04 | ||
|
||
RUN apt-get update && apt-get -y dist-upgrade \ | ||
&& apt-get -y install libffi-dev libsasl2-dev python3-dev \ | ||
sudo libldap2-dev libssl-dev python3-pip python3-setuptools python3-venv \ | ||
mysql-client uwsgi uwsgi-plugin-python3 nginx \ | ||
&& rm -rf /var/cache/apt/archives/* | ||
|
||
RUN useradd -m -s /bin/bash oncall | ||
|
||
COPY src /home/oncall/source/src | ||
COPY setup.py /home/oncall/source/setup.py | ||
COPY MANIFEST.in /home/oncall/source/MANIFEST.in | ||
|
||
WORKDIR /home/oncall | ||
|
||
RUN chown -R oncall:oncall /home/oncall/source /var/log/nginx /var/lib/nginx \ | ||
&& sudo -Hu oncall mkdir -p /home/oncall/var/log/uwsgi /home/oncall/var/log/nginx /home/oncall/var/run /home/oncall/var/relay \ | ||
&& sudo -Hu oncall python3 -m venv /home/oncall/env \ | ||
&& sudo -Hu oncall /bin/bash -c 'source /home/oncall/env/bin/activate && cd /home/oncall/source && pip install .' | ||
|
||
COPY . /home/oncall | ||
COPY ops/config/systemd /etc/systemd/system | ||
COPY ops/daemons /home/oncall/daemons | ||
COPY ops/daemons/uwsgi-docker.yaml /home/oncall/daemons/uwsgi.yaml | ||
COPY db /home/oncall/db | ||
COPY configs /home/oncall/config | ||
COPY ops/entrypoint.py /home/oncall/entrypoint.py | ||
|
||
EXPOSE 8080 | ||
|
||
CMD ["sudo", "-EHu", "oncall", "bash", "-c", "source /home/oncall/env/bin/activate && python -u /home/oncall/entrypoint.py"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
version: '3' | ||
|
||
services: | ||
oncall-web: | ||
build: . | ||
ports: | ||
- "8080:8080" | ||
environment: | ||
- DOCKER_DB_BOOTSTRAP=1 | ||
volumes: | ||
- ./configs/config.docker.yaml:/home/oncall/config/config.yaml | ||
|
||
oncall-mysql: | ||
image: mysql:5.7 | ||
environment: | ||
- MYSQL_ROOT_PASSWORD=1234 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.