Merge #790 Improve the development experience

This commit is contained in:
Matt Prahl
2017-11-14 13:41:35 +00:00
6 changed files with 11 additions and 101 deletions

View File

@@ -14,6 +14,7 @@ RUN dnf install -y \
python-pip \
python-qpid \
python-futures \
python-urlgrabber \
python2-cffi \
python2-cryptography \
python2-pdc-client \

8
Vagrantfile vendored
View File

@@ -3,8 +3,7 @@
$script = <<SCRIPT
grep -q '^127\.0\.0\.1 fedmsg-relay$' /etc/hosts || echo "127.0.0.1 fedmsg-relay" >> /etc/hosts
echo "export KRB5CCNAME=FILE:/var/tmp/krbcc" > /etc/profile.d/module_build_service_developer_env.sh
echo "export MODULE_BUILD_SERVICE_DEVELOPER_ENV=1" >> /etc/profile.d/module_build_service_developer_env.sh
echo "export MODULE_BUILD_SERVICE_DEVELOPER_ENV=1" > /etc/profile.d/module_build_service_developer_env.sh
source /etc/profile.d/module_build_service_developer_env.sh
dnf install -y \
fedmsg-hub \
@@ -25,6 +24,7 @@ $script = <<SCRIPT
python-m2ext \
python-mock \
python-qpid \
python-urlgrabber \
python-virtualenv \
python-futures \
redhat-rpm-config \
@@ -32,10 +32,10 @@ $script = <<SCRIPT
rpm-build \
swig \
systemd-devel
mkdir /etc/module-build-service/
cd /tmp/module_build_service
python setup.py develop
python setup.py egg_info
ln -s /tmp/module_build_service/conf /etc/module-build-service
pip install -r test-requirements.txt
SCRIPT
@@ -52,9 +52,7 @@ Vagrant.configure("2") do |config|
config.vm.synced_folder "./", "/tmp/module_build_service"
# Disable the default share
config.vm.synced_folder ".", "/vagrant", disabled: true
config.vm.provision "file", source: "/tmp/mbs-krbcc", destination: "/var/tmp/krbcc", run: "always"
config.vm.network "forwarded_port", guest_ip: "0.0.0.0", guest: 5000, host: 5000
config.vm.network "forwarded_port", guest_ip: "0.0.0.0", guest: 2001, host: 5001
config.vm.network "forwarded_port", guest_ip: "0.0.0.0", guest: 13747, host: 13747
config.vm.provision "shell", inline: $script
config.vm.provision "shell", inline: $script_services, run: "always"

View File

@@ -95,51 +95,6 @@ class BaseConfiguration(object):
CACHE_DIR = '~/modulebuild/cache'
class DevConfiguration(BaseConfiguration):
DEBUG = True
LOG_BACKEND = 'console'
LOG_LEVEL = 'debug'
MESSAGING_TOPIC_PREFIX = ['org.fedoraproject.dev', 'org.fedoraproject.stg']
ALLOWED_GROUPS = set([
'packager',
# Make this convenient for f2.0 developers
'factory2',
'modularity-wg',
])
# Global network-related values, in seconds
NET_TIMEOUT = 5
NET_RETRY_INTERVAL = 1
# Uncomment next line for local builds
# SYSTEM = 'mock'
if path.exists('/home/fedora/modularity.keytab'):
KRB_PRINCIPAL = 'modularity@STG.FEDORAPROJECT.ORG'
KRB_KEYTAB = '/home/fedora/modularity.keytab'
KRB_CCACHE = '/var/tmp/krb5cc'
else:
# This requires that your principal be listed server side in
# ProxyPrincipals, and that is only true for our modularity system
# user.
# See:
# https://infrastructure.fedoraproject.org/cgit/ansible.git/commit/?id=a28a93dad75248c30c1792ec35f588c8e317c067
# noqa
KOJI_PROXYUSER = False
KOJI_CONFIG = path.join(confdir, 'koji.conf')
KOJI_PROFILE = 'staging'
KOJI_ARCHES = ['x86_64']
KOJI_REPOSITORY_URL = 'http://kojipkgs.stg.fedoraproject.org/repos'
OIDC_CLIENT_SECRETS = path.join(confdir, 'client_secrets.json')
OIDC_REQUIRED_SCOPE = 'https://mbs.fedoraproject.org/oidc/submit-build'
COPR_CONFIG = path.join(confdir, 'copr.conf')
class TestConfiguration(BaseConfiguration):
BUILD_LOGS_DIR = '/tmp'
BUILD_LOGS_NAME_FORMAT = 'build-{id}.log'
@@ -176,3 +131,9 @@ class LocalBuildConfiguration(BaseConfiguration):
ARCH_FALLBACK = 'x86_64'
ALLOW_CUSTOM_SCMURLS = True
class DevConfiguration(LocalBuildConfiguration):
DEBUG = True
LOG_BACKEND = 'console'
COPR_CONFIG = path.join(confdir, 'copr.conf')

View File

@@ -17,8 +17,6 @@ services:
expose:
- 2001
- 2003
ports:
- "5001:2001"
volumes_from:
- base
@@ -29,16 +27,8 @@ services:
command: bash -c "while [ ! -f /etc/module-build-service/.ready ] ; do sleep 1 ; done ; fedmsg-hub"
links:
- fedmsg-relay
environment:
# Check /var/tmp/krbcc and make sure that it is not a directory. If it
# is, then delete it with 'sudo rm -rf /var/tmp/krbcc'.
# Initialize the file before running 'docker-compose up' with:
# $ KRB5CCNAME=FILE:/var/tmp/krbcc kinit YOUR_USERNAME@FEDORAPROJECT.ORG
- KRB5CCNAME=FILE:/var/tmp/krbcc
volumes_from:
- base
volumes:
- /tmp/mbs-krbcc:/var/tmp/krbcc:Z
frontend:
depends_on:

View File

@@ -53,47 +53,6 @@ refer to the `Running Tests` section first.
We have two mechanisms for quickly setting up a development environment,
`docker-compose` and `vagrant`.
In order to to setup a development environment, it is required that you have
your Fedora kerberos credentials generated in a *special location*. Before
starting your development environment, run the following::
$ KRB5CCNAME=FILE:/tmp/mbs-krbcc kinit YOUR_USERNAME@STG.FEDORAPROJECT.ORG
If you have problems in later steps with kerberos reading those credentials
inside the `scheduler` container, you should check that `/var/tmp/krbcc` exists
on your machine and that *it is not a directory*. Try removing it with `$ sudo
rm -rf /var/tmp/krbcc` and running `kinit` again. Also, check for permissions
and SELinux context of the credentials cache file.
PDC and pdc-updater
-------------------
To be able to communicate with PDC, your development instance will need to
be able to access the URL defined in the configuration option `PDC_URL`,
located in your local `conf/config.py`
To communicate with pdc-updater, you will need to configure SSH on your host
machine to forward remote ports from pdc-updater's devel instance, typically
`modularity.fedorainfracloud.org`. This enables communication between PDC
and your Module Build Service development instance.
Your `ssh_config` should look like this::
Host MODULARITY-DEV
HostName modularity.fedorainfracloud.org
User fedora
RemoteForward 300x 127.0.0.1:5001 # x is one of 0...9
The configuration above assumes that the development instance with
pdc-updater has the following endpoints configured (typically in
`/etc/fedmsg.d/endpoints.py`)::
endpoints={
"rida.local": [
"tcp://127.0.0.1:300%i" % i for i in range(10)
],
...
Docker
------

View File

@@ -4,3 +4,4 @@ nose
pytest
vcrpy
flake8
tox