install virtualenv on host
continuous-integration/drone/pr Build is passing Details

This commit is contained in:
Max Erenberg 2021-09-17 22:29:34 -04:00
parent f873d04139
commit d7e9de5f61
6 changed files with 32 additions and 14 deletions

View File

@ -46,7 +46,11 @@ cp .drone/nsswitch.conf /etc/nsswitch.conf
service nslcd start service nslcd start
ldapadd -c -f .drone/data.ldif -Y EXTERNAL -H ldapi:/// ldapadd -c -f .drone/data.ldif -Y EXTERNAL -H ldapi:///
if [ -z "$CI" ]; then if [ -z "$CI" ]; then
ldapadd -c -f .drone/uwldap_data.ldif -Y EXTERNAL -H ldapi:/// ||: ldapadd -c -f .drone/uwldap_data.ldif -Y EXTERNAL -H ldapi:/// || true
# setup ldapvi for convenience
apt install -y vim ldapvi
echo 'export EDITOR=vim' >> /root/.bashrc
echo 'alias ldapvi="ldapvi -Y EXTERNAL -h ldapi:///"' >> /root/.bashrc
fi fi
# KERBEROS # KERBEROS

View File

@ -9,8 +9,15 @@ overview of its architecture.
### Docker ### Docker
If you are not modifying code related to email or Mailman, then you may use If you are not modifying code related to email or Mailman, then you may use
Docker containers instead, which are much easier to work with than the VM. Docker containers instead, which are much easier to work with than the VM.
First, make sure you create the virtualenv:
```sh
docker run --rm -v "$PWD:$PWD" -w "$PWD" -u $(id -u):$(id -g) python:3.7-buster \
sh -c 'python -m venv venv && . venv/bin/activate && pip install -r requirements.txt -r dev-requirements.txt'
``` ```
docker-compose up -d # or without -d to run in the foreground Then bring up the containers:
```sh
docker-compose up -d # or without -d to run in the foreground
``` ```
This will create some containers with the bare minimum necessary for ceod to This will create some containers with the bare minimum necessary for ceod to
run, and start ceod on each of phosphoric-acid, mail, and coffee container. run, and start ceod on each of phosphoric-acid, mail, and coffee container.
@ -23,7 +30,8 @@ To use ceo, run the following:
```sh ```sh
docker-compose exec phosphoric-acid bash docker-compose exec phosphoric-acid bash
su ctdalek su ctdalek
python -m ceo # the password for kerobos is krb5 . venv/bin/activate
python -m ceo # the password is krb5
``` ```
This should bring up the TUI. This should bring up the TUI.
@ -162,7 +170,7 @@ pip install -r requirements.txt
pip install -r dev-requirements.txt pip install -r dev-requirements.txt
``` ```
## Running the application #### Running the application
ceod is a distributed application, with instances on different hosts offering ceod is a distributed application, with instances on different hosts offering
different services. different services.
Therefore, you will need to run ceod on multiple hosts. Currently, those are Therefore, you will need to run ceod on multiple hosts. Currently, those are

View File

@ -15,7 +15,7 @@ services:
auth1: auth1:
<<: *common <<: *common
image: debian:buster image: debian:buster
hostname: auth0 hostname: auth1
command: auth1 command: auth1
coffee: coffee:

View File

@ -1,10 +1,16 @@
#!/bin/sh -e #!/bin/sh -e
if ! [ -d venv ]; then
echo "You need to create the virtualenv first!" >&2
exit 1
fi
host="$1" host="$1"
[ -x ".drone/$host-setup.sh" ] && "./.drone/$host-setup.sh" [ -x ".drone/$host-setup.sh" ] && ".drone/$host-setup.sh"
if [ "$host" = auth1 ]; then if [ "$host" = auth1 ]; then
exec sleep infinity exec sleep infinity
else else
python3 -m pip install -r requirements.txt -r dev-requirements.txt . venv/bin/activate
exec ./.drone/supervise.sh flask run -h 0.0.0.0 -p 9987 exec .drone/supervise.sh flask run -h 0.0.0.0 -p 9987
fi fi

View File

@ -4,12 +4,12 @@ from aiohttp import web
class MockMailmanServer: class MockMailmanServer:
def __init__(self, port=8002): def __init__(self, port=8001, prefix='/3.1'):
self.port = port self.port = port
self.app = web.Application() self.app = web.Application()
self.app.add_routes([ self.app.add_routes([
web.post('/members', self.subscribe), web.post(prefix + '/members', self.subscribe),
web.delete('/lists/{mailing_list}/member/{address}', self.unsubscribe), web.delete(prefix + '/lists/{mailing_list}/member/{address}', self.unsubscribe),
]) ])
self.runner = web.AppRunner(self.app) self.runner = web.AppRunner(self.app)
self.loop = asyncio.new_event_loop() self.loop = asyncio.new_event_loop()
@ -71,5 +71,5 @@ class MockMailmanServer:
if __name__ == '__main__': if __name__ == '__main__':
server = MockMailmanServer(8001) server = MockMailmanServer()
server.start() server.start()

View File

@ -9,7 +9,7 @@ fs_root_host = phosphoric-acid
mailman_host = phosphoric-acid mailman_host = phosphoric-acid
database_host = phosphoric-acid database_host = phosphoric-acid
use_https = false use_https = false
port = 9987 port = 9988
[ldap] [ldap]
admin_principal = ceod/admin admin_principal = ceod/admin
@ -40,7 +40,7 @@ smtp_url = smtp://localhost:8025
smtp_starttls = false smtp_starttls = false
[mailman3] [mailman3]
api_base_url = http://localhost:8002 api_base_url = http://localhost:8001/3.1
api_username = restadmin api_username = restadmin
api_password = mailman3 api_password = mailman3
new_member_list = csc-general new_member_list = csc-general