Skip to content
Snippets Groups Projects
Commit be9db339 authored by Piotr Maślanka's avatar Piotr Maślanka
Browse files

sane

parent 6ce90395
No related branches found
No related tags found
No related merge requests found
Pipeline #1290 passed with stages
in 3 minutes and 56 seconds
...@@ -3,7 +3,6 @@ stages: ...@@ -3,7 +3,6 @@ stages:
- build - build
- deploy - deploy
- cleanup - cleanup
deploy_wine-tibbo: deploy_wine-tibbo:
stage: deploy stage: deploy
tags: tags:
...@@ -19,8 +18,6 @@ clean_wine-tibbo: ...@@ -19,8 +18,6 @@ clean_wine-tibbo:
when: always when: always
allow_failure: true allow_failure: true
script: script:
- cp -f SkeletonVagrantfile wine-tibbo/Vagrantfile
- cd wine-tibbo
- vagrant destroy -f - vagrant destroy -f
preclean_wine-tibbo: preclean_wine-tibbo:
tags: tags:
...@@ -29,26 +26,16 @@ preclean_wine-tibbo: ...@@ -29,26 +26,16 @@ preclean_wine-tibbo:
when: always when: always
allow_failure: true allow_failure: true
script: script:
- cp -f SkeletonVagrantfile wine-tibbo/Vagrantfile - vagrant destroy -f
- cd wine-tibbo
- vagrant destroy -f
build_wine-tibbo: build_wine-tibbo:
stage: build stage: build
tags: tags:
- vagrant - vagrant
- develop19216822423 - develop19216822423
before_script:
- cd wine-tibbo
script: script:
- cd $CI_PROJECT_DIR
- cd wine-tibbo
- vagrant up - vagrant up
- rm -f /var/www/html/dev/vagrant/spwine-tibbo.box || true - rm -f /var/www/html/dev/vagrant/spwine-tibbo.box || true
- vagrant package --out /var/www/html/dev/vagrant/spwine-tibbo.box - 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 - mv -f /var/www/html/dev/vagrant/spwine-tibbo.box /var/www/html/dev/vagrant/wine-tibbo.box
- cd ..
after_script: after_script:
- cd $CI_PROJECT_DIR
- cd wine-tibbo
- vagrant destroy -f - vagrant destroy -f
- cd ..
# 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
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
...@@ -2,17 +2,9 @@ ...@@ -2,17 +2,9 @@
Vagrant.configure("2") do |config| Vagrant.configure("2") do |config|
config.vm.box = "hashicorp/precise32" 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 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' su vagrant -c 'bash /vagrant/build_as_vagrant.sh'
# Minify # Minify
......
#!/bin/bash #!/bin/bash
set -e
export DISPLAY=:0.0 export DISPLAY=:0.0
export WINEPREFIX="/home/vagrant/.wine" export WINEPREFIX="/home/vagrant/.wine"
export WINEARCH="win32" export WINEARCH="win32"
# Install Mono for .NET 4.0 apt-get update
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF apt-get install -y python-software-properties
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 # 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 wget https://dl.winehq.org/wine-builds/Release.key
sudo apt-key add Release.key apt-key add Release.key
sudo apt-add-repository https://dl.winehq.org/wine-builds/ubuntu/ apt-add-repository https://dl.winehq.org/wine-builds/ubuntu/
## update
apt-get update apt-get update
apt-get install --install-recommends winehq-stable
apt-get install -y wget xvfb wine unzip fonts-wine winetricks # 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 # Install command
cp -f /vagrant/tibbo_build.sh /usr/sbin/tibbo_build cp -f /vagrant/tibbo_build.sh /usr/sbin/tibbo_build
......
...@@ -17,12 +17,8 @@ ln -s /vagrant /home/vagrant/.wine/drive_c/vagrant ...@@ -17,12 +17,8 @@ ln -s /vagrant /home/vagrant/.wine/drive_c/vagrant
# Install Tibbo tools # Install Tibbo tools
mkdir -p "/home/vagrant/.wine/drive_c/Program Files/Tibbo" mkdir -p "/home/vagrant/.wine/drive_c/Program Files/Tibbo"
if [ -f "/wynurz-utils/tide-tibbo-lite-5.1.3-win32.zip" ]; then wget http://dev.dms-serwis.com.pl/misc/tide-tibbo-lite-5.1.3-win32.zip -O /tmp/tibbo.zip
unzip /wynurz-utils/tide-tibbo-lite-5.1.3-win32.zip -d "/home/vagrant/.wine/drive_c/Program Files/Tibbo" unzip /tmp/tibbo.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
# WINE extensions - max 15 minutes! # WINE extensions - max 15 minutes!
cd /home/vagrant/.wine/drive_c cd /home/vagrant/.wine/drive_c
......
#!/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)
#!/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
File moved
# 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"
```
#!/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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment