diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 60ddd4bb78e9bf7020a31b2754efdc7792ddf1ec..8880ffd2131501a4cdb1717dbdf4e29b3833305d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -3,7 +3,6 @@ stages: - build - deploy - cleanup - deploy_wine-tibbo: stage: deploy tags: @@ -19,8 +18,6 @@ clean_wine-tibbo: when: always allow_failure: true script: - - cp -f SkeletonVagrantfile wine-tibbo/Vagrantfile - - cd wine-tibbo - vagrant destroy -f preclean_wine-tibbo: tags: @@ -29,26 +26,16 @@ preclean_wine-tibbo: when: always allow_failure: true script: - - cp -f SkeletonVagrantfile wine-tibbo/Vagrantfile - - cd wine-tibbo - - vagrant destroy -f + - vagrant destroy -f build_wine-tibbo: stage: build tags: - vagrant - develop19216822423 - before_script: - - cd wine-tibbo script: - - cd $CI_PROJECT_DIR - - cd wine-tibbo - vagrant up - rm -f /var/www/html/dev/vagrant/spwine-tibbo.box || true - vagrant package --out /var/www/html/dev/vagrant/spwine-tibbo.box - mv -f /var/www/html/dev/vagrant/spwine-tibbo.box /var/www/html/dev/vagrant/wine-tibbo.box - - cd .. after_script: - - cd $CI_PROJECT_DIR - - cd wine-tibbo - vagrant destroy -f - - cd .. diff --git a/README.md b/README.md deleted file mode 100644 index 833c16d9961e80799ee6a7fa5440d971d510a3e2..0000000000000000000000000000000000000000 --- a/README.md +++ /dev/null @@ -1,87 +0,0 @@ -# vagrant-boxen - -ZbiĂłr typowych boxĂłw vagrantowych, co by kompilacje szybciej szĹy. -MoĹźna dodawaÄ wĹasne! - -Zobacz dostÄpne [http://git.dms-serwis.com.pl/henrietta/vagrant-boxen/branches](branche) -Ĺźeby widzieÄ jakie sÄ vmki. - -Ew wbij na [http://dev.dms-serwis.com.pl/vagrant](http://dev.dms-serwis.com.pl/vagrant). - -W oparciu o *debian/contrib-jessie64* - -# Robienie wĹasnych boxĂłw -Chcesz jakÄ Ĺ typowÄ VM-kÄ? - -StwĂłrz sobie jakÄ Ĺ gaĹÄ Ĺş o nazwie rĂłwnej nazwie swojego boxa. MoĹźesz w `make.py` zmieniÄ -PREFIX, jeĹli chcesz. - -WywoĹaj: -```bash -python make.py newbox nazwa_boxa -``` -Teraz baw siÄ folderem o nazwie `nazwa_boxa`. - -Np. maszyna **funky** -**funky/build.sh**: -```bash -#!/usr/bin/env bash - -wynurz.sh java -wynurz.sh cassandra -wynurz.sh rabbitmq -wynurz.sh zookeeper -``` - -**funky/README.md**: -```markdown -# funky - -java + cass + rmq + zk - -Maszyna z: -* CassandrÄ .. -``` -Po ukoĹczonej pracy odpal `python make.py` - -SposĂłb uĹźycia bÄdzie w README w katalogu po wbiciu `python make.py` w gĹĂłwnym katalogu. -Zostanie doczepiony do twojego README. Ponowne wywoĹanie nie doczepiÄ go ponownie. - -Generalnie buduje siÄ tylko to co jest na dalej gaĹÄzi. Po wywoĹaniu `python make.py` -wyĹlij to na repo i niech CI czyni magiÄ. _.gitlab-ci.yml_ generowany jest przez -`python make.py`. - -Zawsze dostÄpna jest podczas buildu komenda `wynurz`. Wymaga ona roota, ale weĹşmie sobie sama za -pomocÄ _sudo_ jeĹli go nie dasz. **NIE UĹťYWAJ** _/vagrant/wynurz.sh_. - -Po pomyĹlnej kompilacji i deployu (dzieje siÄ automatycznie) plik box moĹźna zassaÄ z -[http://dev.dms-serwis.com.pl/vagrant/](http://dev.dms-serwis.com.pl/vagrant/), albo -po prostu wpisaÄ wygenerowany przez make.py - -**master** to taka czysta kartka - do robienia nowych branchĂłw tylko. -Wpisz siÄ w **mastera** - -## wynurz - -Przyjmuje jeden argument. DostÄpne to: -* **java** - pobiera i instaluje Oracle Java 8 JRE -* **node4** - pobiera i instaluje NodeJS 4.x -* **node5** - pobiera i instaluje NodeJS 5.x -* **jdk** - pobiera i instaluje Oracle Java JDK 8 w folderze uĹźytkownika _vagrant_. - * Nie ustawia zmiennych Ĺrodowiskowych ĹťADNYCH! - * DostÄpna tylko dla uĹźytkownika _vagrant_ -* **cassandra** - pobiera i instaluje Apache Cassandra 3.0.9 - * NastÄpnie po 30 sekundach w tle zatrzymuje jÄ - * UsĹuga bÄdzie wstawaÄ przy starcie VM-ki -* **zookeeper** - pobiera i instaluje Apache ZooKeeper - * NastÄpnie po 20 sekundach w tle zatrzymuje jÄ - * UsĹuga bÄdzie wstawaÄ przy starcie VM-ki -* **rabbitmq** - pobiera i instaluje RabbitMQ 3.3.5 - * UsĹuga bÄdzie wstawaÄ przy starcie VM-ki -* **postgresql** - pobiera i instaluje PostgreSQL 9.4 - * User: postgres - * HasĹo: postgres - * PoĹÄ czenia: TCP z dowolnego adresu -* **get-adt25** - pobierz Android Development Tools r25 i wypakuj do /home/vagrant - * istnieÄ bÄdzie katalog _/home/vagrant/tools_ - * zmienne Ĺrodowiskowe nie bÄdÄ zmienione diff --git a/SkeletonVagrantfile b/SkeletonVagrantfile deleted file mode 100644 index 59e9a14b5d46e348749a30f3263fb7fa931aea33..0000000000000000000000000000000000000000 --- a/SkeletonVagrantfile +++ /dev/null @@ -1,33 +0,0 @@ - -Vagrant.configure("2") do |config| - config.vm.box = "debian/contrib-jessie32" - - config.vm.provider "virtualbox" do |v| - v.memory = 1260 - v.cpus = 3 - config.vm.synced_folder "/var/www/html/dev/misc", "/wynurz-utils", :mount_options => ["ro"] - end - - - config.vm.provision "shell", inline: <<-SHELL - apt-get update - apt-get install -y curl - cp /vagrant/wynurz.sh /usr/bin/wynurz - chmod ugo+rx /usr/bin/wynurz - - bash /vagrant/run.sh - - # Minify - apt-get clean - rm -f /usr/bin/wynurz - dd if=/dev/zero of=/EMPTY bs=1M - rm -f /EMPTY - rm -rf /tmp/* - # udev rules - rm /etc/udev/rules.d/70-persistent-net.rules || true - mkdir /etc/udev/rules.d/70-persistent-net.rules || true - rm -rf /dev/.udev/ || true - rm /lib/udev/rules.d/75-persistent-net-generator.rules || true - - SHELL -end diff --git a/wine-tibbo/Vagrantfile b/Vagrantfile similarity index 69% rename from wine-tibbo/Vagrantfile rename to Vagrantfile index 59b9f13480c3fa828adc199cd2a029de5824f9d8..c7e19835794cb9298fa69b944f0aa8eeeab7ca9b 100644 --- a/wine-tibbo/Vagrantfile +++ b/Vagrantfile @@ -2,17 +2,9 @@ Vagrant.configure("2") do |config| config.vm.box = "hashicorp/precise32" - config.vm.provider "virtualbox" do |v| - v.memory = 1260 - v.cpus = 3 - config.vm.synced_folder "/var/www/html/dev/misc", "/wynurz-utils", :mount_options => ["ro"] - end - config.vm.provision "shell", inline: <<-SHELL - apt-get update - apt-get install -y curl - bash build.sh + bash /vagrant/build.sh su vagrant -c 'bash /vagrant/build_as_vagrant.sh' # Minify diff --git a/build.sh b/build.sh new file mode 100644 index 0000000000000000000000000000000000000000..90e15cc155392e75663048d05f79295c9b404341 --- /dev/null +++ b/build.sh @@ -0,0 +1,38 @@ +#!/bin/bash +set -e + +export DISPLAY=:0.0 +export WINEPREFIX="/home/vagrant/.wine" +export WINEARCH="win32" + +apt-get update +apt-get install -y python-software-properties + +# Repositories +## Mono +apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF +echo "deb http://download.mono-project.com/repo/debian wheezy main" | sudo tee /etc/apt/sources.list.d/mono-xamarin.list +## WineHQ +wget https://dl.winehq.org/wine-builds/Release.key +apt-key add Release.key +apt-add-repository https://dl.winehq.org/wine-builds/ubuntu/ +## update +apt-get update + +# Install things +TO_INSTALL="" +## Mono for .NET 4.0, and winbind for ntlm_auth +TO_INSTALL="$TO_INSTALL mono-complete winbind" +## WINE +TO_INSTALL="$TO_INSTALL wine winetricks xvfb" +## Things +TO_INSTALL="$TO_INSTALL unzip curl" +## roll - globbing intended +apt-get install -y $TO_INSTALL + +# Install command +cp -f /vagrant/tibbo_build.sh /usr/sbin/tibbo_build +chmod ugo+rx /usr/sbin/tibbo_build + +# Sanitize +chown -R vagrant:vagrant /home/vagrant diff --git a/wine-tibbo/build_as_vagrant.sh b/build_as_vagrant.sh similarity index 58% rename from wine-tibbo/build_as_vagrant.sh rename to build_as_vagrant.sh index 47b2a549f70a71f3b90468a150c9d4f3cfa38d97..5013fb6aef51d013b379f73c2b3451035958cb73 100644 --- a/wine-tibbo/build_as_vagrant.sh +++ b/build_as_vagrant.sh @@ -17,12 +17,8 @@ ln -s /vagrant /home/vagrant/.wine/drive_c/vagrant # Install Tibbo tools mkdir -p "/home/vagrant/.wine/drive_c/Program Files/Tibbo" -if [ -f "/wynurz-utils/tide-tibbo-lite-5.1.3-win32.zip" ]; then - unzip /wynurz-utils/tide-tibbo-lite-5.1.3-win32.zip -d "/home/vagrant/.wine/drive_c/Program Files/Tibbo" -else - wget http://dev.dms-serwis.com.pl/misc/tide-tibbo-lite-5.1.3-win32.zip -O /tmp/tibbo.zip - unzip /tmp/tibbo.zip -d "/home/vagrant/.wine/drive_c/Program Files/Tibbo" -fi +wget http://dev.dms-serwis.com.pl/misc/tide-tibbo-lite-5.1.3-win32.zip -O /tmp/tibbo.zip +unzip /tmp/tibbo.zip -d "/home/vagrant/.wine/drive_c/Program Files/Tibbo" # WINE extensions - max 15 minutes! cd /home/vagrant/.wine/drive_c diff --git a/make.py b/make.py deleted file mode 100644 index 8ceed2a52425fec151d91815f866f4efd08426cd..0000000000000000000000000000000000000000 --- a/make.py +++ /dev/null @@ -1,211 +0,0 @@ -#!/usr/bin/env python -# coding=UTF-8 -""" -Run when - - new boxes are added - - their README.md is changed -""" -from __future__ import print_function, absolute_import, division - -import os -import os.path -import sys - -PREFIX = 'henrietta/' - - -def readfile(path, prefix=None, lines=False, strip=True): - if prefix is not None: - path = os.path.join(prefix, path) - - with open(path, 'rb') as f: - if lines: - d = f.readlines() - if strip: - d = [q.strip() for q in d] - else: - d = f.read() - if strip: - d = d.strip() - return d - - -def writefile(content, path, prefix=None, lines=False): - if prefix is not None: - path = os.path.join(prefix, path) - - with open(path, 'w' if lines else 'wb') as f: - if lines: - f.writelines([q+'\n' for q in content]) - else: - if not isinstance(content, list): - content = [content] - for piece in content: - f.write(piece) - - -if __name__ == '__main__': - dirs = [dir for dir in os.listdir('.') if os.path.isdir(dir) and (dir not in ('.git', 'example'))] - exi = lambda box, sup: os.path.exists(os.path.join(box, 'build%s.sh' % (sup,))) - boxes = [box for box in dirs if exi(box, '') or exi(box, '_as_vagrant')] - - if len(sys.argv) == 1: - # Generate Gitlab CI file - gitlabci = ["""stages: - - preclean - - build - - deploy - - cleanup -"""] - - for box in boxes: - - readme = readfile('README.md', box, lines=True, strip=True) - - if '---' in readme: - readme = readme[:readme.index('---')] - - readme = readme + ['---', '', 'Usage in Vagrantfile:', '```', - 'config.vm.box = "'+PREFIX+box+'"', - 'config.vm.box_url = "http://dev.dms-serwis.com.pl/vagrant/'+box+'.box"', - '```'] - - writefile(readme, 'README.md', box, lines=True) - - try: - os.unlink(os.path.join(box, 'metadata.json')) - except OSError: - pass - - gitlabci.append(''' -deploy_$BOX: - stage: deploy - tags: - - vagrant - - develop19216822423 - script: - - vagrant box remove $PREFIX$BOX || true - - vagrant box add $PREFIX$BOX file:///var/www/html/dev/vagrant/$BOX.box -clean_$BOX: - tags: - - vagrant - stage: cleanup - when: always - allow_failure: true - script: - - cp -f SkeletonVagrantfile $BOX/Vagrantfile - - cd $BOX - - vagrant destroy -f -preclean_$BOX: - tags: - - vagrant - stage: preclean - when: always - allow_failure: true - script: - - cp -f SkeletonVagrantfile $BOX/Vagrantfile - - cd $BOX - - vagrant destroy -f -build_$BOX: - stage: build - tags: - - vagrant - - develop19216822423 - before_script: - - cp *.sh $BOX/ - - cp SkeletonVagrantfile $BOX/Vagrantfile - - cd $BOX - - python ../make.py meta - script: - - cd $CI_PROJECT_DIR - - cd $BOX - - vagrant up - - rm -f /var/www/html/dev/vagrant/sp$BOX.box || true - - vagrant package --out /var/www/html/dev/vagrant/sp$BOX.box - - mv -f /var/www/html/dev/vagrant/sp$BOX.box /var/www/html/dev/vagrant/$BOX.box - - cd .. - after_script: - - cd $CI_PROJECT_DIR - - cd $BOX - - vagrant destroy -f - - cd .. -'''.replace('$BOX', box).replace('$PREFIX', PREFIX).replace('\n', os.linesep)) - - if len(gitlabci) == 0: - gitlabci = ['''check_validity: - stage: test - script: - - python make.py newbox test - - cd test - - python ../make.py meta - - grep "1.0" metadata.json - - grep "test" metadata.json - - cd .. -'''.replace('\n', os.linesep)] - - writefile(gitlabci, '.gitlab-ci.yml') - - if ' '.join(sys.argv).endswith('meta'): - box = os.path.split(os.getcwd())[-1] - - readme = readfile('README.md', lines=True) - description = readme[2] - - # Try get version - try: - version = readme[3] - if not version.startswith('Version:'): - raise IndexError() - version = version.split(':')[1].strip() - except IndexError: - version = '1.0' - - writefile('''{ - "description": "$DESCRIPTION", - "short_description": "$DESCRIPTION", - "name": "$PREFIX$BOX", - "versions": [{ - "version": "$VERSION", - "status": "active", - "description_html": "<p>$DESCRIPTION</p>", - "description_markdown": "$DESCRIPTION", - "providers": [{ - "name": "virtualbox", - "url": "http://dev.dms-serwis.com.pl/vagrant/$BOX.box" - }] - }] -} -'''.replace('$DESCRIPTION', description).replace('$BOX', box).replace('$PREFIX', PREFIX).replace('$VERSION', version), - 'metadata.json') - - if len(sys.argv) == 3: - if sys.argv[-2] == 'newbox': - box = sys.argv[-1] - os.mkdir(box) - writefile('''# $BOX - -This is description of the box. It will be copied. Keep it short and single-line. Don't remove the line break before. -Version: 1.0 - -Write what this box consists of and how it behaves. -First four lines have a special meaning - dont move them around. Change only version number, not the word. - ---- - -This section will be automatically replaced by `python make.py` with auto-generated -content of Vagrantfile that will refer to this box. -'''.replace('$BOX', box).replace('$PREFIX', PREFIX).replace('\n', os.linesep), 'README.md', box) - - writefile('''#!/bin/bash - -# This will be executed during build process as root -# You can delete it if you want to. -# cd into a directory if you depend on a particular working directory. -''', 'build.sh', box) - - writefile('''#!/bin/bash - -# This will be executed during build process as user Vagrant -# You can delete it if you want to. -# cd into a directory if you depend on a particular working directory. -''', 'build_as_vagrant.sh', box) diff --git a/run.sh b/run.sh deleted file mode 100644 index e88e626543086c97b09b17b9193f1ea18aa1bd1b..0000000000000000000000000000000000000000 --- a/run.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env bash - -set -e -set -x -shutdown -h +60 "Timeout on VM creation" - - -if [ -f "/vagrant/build.sh" ]; then - bash /vagrant/build.sh -fi - -if [ -f "/vagrant/build_as_vagrant.sh" ]; then - su vagrant -c 'bash /vagrant/build_as_vagrant.sh' -fi diff --git a/wine-tibbo/tibbo_build.sh b/tibbo_build.sh similarity index 100% rename from wine-tibbo/tibbo_build.sh rename to tibbo_build.sh diff --git a/wine-tibbo/README.md b/wine-tibbo/README.md deleted file mode 100644 index d1b7210666223d19abf21b04ffbb8df404f0aada..0000000000000000000000000000000000000000 --- a/wine-tibbo/README.md +++ /dev/null @@ -1,18 +0,0 @@ -# wine-tibbo - -Debian with Tibbo IDE 5.3.1 -Version: 1.0 - -How to use: - -1. Copy your project to `/vagrant` -2. Inside vagrant VM, call `tibbo_build FILENAME.tpr` -3. Enjoy .tpc files - ---- - -Usage in Vagrantfile: -``` -config.vm.box = "henrietta/wine-tibbo" -config.vm.box_url = "http://dev.dms-serwis.com.pl/vagrant/wine-tibbo.box" -``` diff --git a/wine-tibbo/build.sh b/wine-tibbo/build.sh deleted file mode 100644 index 8e79c887ff5602e6400974e02d2adfdef5795df9..0000000000000000000000000000000000000000 --- a/wine-tibbo/build.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash -export DISPLAY=:0.0 -export WINEPREFIX="/home/vagrant/.wine" -export WINEARCH="win32" - -# Install Mono for .NET 4.0 -sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF -echo "deb http://download.mono-project.com/repo/debian wheezy main" | sudo tee /etc/apt/sources.list.d/mono-xamarin.list -sudo apt-get update -apt-get install -y mono-complete winbind # winbind - ntlm_auth for .NET - -# Install WINE -wget https://dl.winehq.org/wine-builds/Release.key -sudo apt-key add Release.key -sudo apt-add-repository https://dl.winehq.org/wine-builds/ubuntu/ -apt-get update -apt-get install --install-recommends winehq-stable -apt-get install -y wget xvfb wine unzip fonts-wine winetricks - -# Install command -cp -f /vagrant/tibbo_build.sh /usr/sbin/tibbo_build -chmod ugo+rx /usr/sbin/tibbo_build - -# Sanitize -chown -R vagrant:vagrant /home/vagrant diff --git a/wynurz.sh b/wynurz.sh deleted file mode 100644 index 3dc3dd17503ddbfb248f7b94091a06476883a1d4..0000000000000000000000000000000000000000 --- a/wynurz.sh +++ /dev/null @@ -1,89 +0,0 @@ -#!/usr/bin/env bash - -if [ "$EUID" -ne 0 ]; then - echo "Invoked as non-root, sudoing..." - sudo -- wynurz "$@" - exit $? -fi - -if [ $1 == "java" ]; then - # Oracle Java JRE - apt-get install -y debconf-utils - echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" > /etc/apt/sources.list.d/webupd8team-java.list - echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" >> /etc/apt/sources.list.d/webupd8team-java.list - apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886 - apt-get update - echo debconf shared/accepted-oracle-license-v1-1 select true | debconf-set-selections - apt-get install -y oracle-java8-installer -fi - - -if [ $1 == "node4" ]; then - apt-get install -y curl git build-essential unzip - curl -sL https://deb.nodesource.com/setup_4.x | bash - - apt-get install -y nodejs -fi - -if [ $1 == "node5" ]; then - apt-get install -y curl git build-essential unzip - curl -sL https://deb.nodesource.com/setup_5.x | bash - - apt-get install -y nodejs -fi - -if [ $1 == "get-adt25" ]; then - cd /home/vagrant - if [ -e "/wynurz-utils/tools_r25.2.3-linux.zip" ]; then - ln -s /wynurz-utils/tools_r25.2.3-linux.zip /home/vagrant/tools_r25.2.3-linux.zip - else - wget -nv http://dev.dms-serwis.com.pl/misc/tools_r25.2.3-linux.zip - fi; - unzip tools_r25.2.3-linux.zip - rm -f tools_r25.2.3-linux.zip -fi - -if [ $1 == "jdk" ]; then - cd /home/vagrant - if [ -e "/wynurz-utils/jdk-8u121-linux-x64.tar.gz" ]; then - ln -s /wynurz-utils/jdk-8u121-linux-x64.tar.gz /home/vagrant/jdk-8u121-linux-x64.tar.gz - else - wget -nv http://dev.dms-serwis.com.pl/misc/jdk-8u121-linux-x64.tar.gz - fi; - tar xzf jdk-8u121-linux-x64.tar.gz - rm -f jdk-8u121-linux-x64.tar.gz - update-alternatives --install /usr/bin/java java /home/vagrant/jdk1.8.0_121/bin/java 100 - update-alternatives --install /usr/bin/javac javac /home/vagrant/jdk1.8.0_121/bin/javac 100 - update-alternatives --install /usr/bin/jar jar /home/vagrant/jdk1.8.0_121/bin/jar 100 - update-alternatives --install /usr/bin/jarsigner jarsigner /home/vagrant/jdk1.8.0_121/bin/jarsigner 100 -fi - -if [ $1 == "cassandra" ]; then - # Install Apache Cassandra - echo "deb http://debian.datastax.com/community stable main" > /etc/apt/sources.list.d/cassandra.sources.list - curl -L http://debian.datastax.com/debian/repo_key | apt-key add - - apt-get update - apt-get install -y cassandra=3.0.9 dsc30 cassandra-tools - - (sleep 30 && - service cassandra stop && - rm -rf /var/lib/cassandra/*) & -fi - -if [ $1 == "zookeeper" ]; then - apt-get install -y zookeeper zookeeperd - (service zookeeper stop && - sleep 20 && - service zookeeper stop) & -fi - -if [ $1 == "rabbitmq" ]; then - apt-get install -y rabbitmq-server=3.3.5-1.1 - service rabbitmq-server stop & -fi - -if [ $1 == "postgresql" ]; then - apt-get install -y postgresql-9.4 - (echo "host all all 0.0.0.0/0 md5" >> /etc/postgresql/9.4/main/pg_hba.conf && - echo "listen_addresses = '*'" >> /etc/postgresql/9.4/main/postgresql.conf && - sudo -u postgres psql --c "ALTER USER postgres WITH PASSWORD 'postgres';" && - systemctl stop postgresql.service) & -fi \ No newline at end of file