#gitrepo
Explore tagged Tumblr posts
irarelypostanything · 5 years ago
Text
Let’s just pretend I finished writing that book that I want to write
...and let’s just say, as a hypothetical/thought experiment, that it’s perfect.  Maybe the ideas for it were transferred to someone a million times better at writing.  Maybe it’s really popular, maybe only I read it...whatever.  The point is, it’s said exactly what it is I want it to say.  The meaning is there.  It delivers perfectly.
What would it be saying, then?
It’s about these people in their twenties, and they care about their careers far more than they care about things like love, family, and intimacy.  It’s a parallel universe where everything is flipped, so career is the thing they’re all passionate about and love is a mere afterthought.  Which is kind of sad.  They’re approaching their thirties, and haven’t even thought about the notion of settling down and getting married.
Why?  Because it doesn’t mean anything to them.  They can date and break up and date and break up, then swipe right 20 more times before the night is done.  They make so much money from their jobs that even raising kids seems like an abstraction they’ll work through later.  Send them to daycare.  Marry people who can stay at home.  They also treat friendship mostly as business, because why wouldn’t they?  Why drive a gift over when you can ship it on Amazon?  Why spend five hours in person with a friend when you can have a Zoom conversation?
There’s this constant tone shift, because it’s a parallel universe, whenever it transitions from talking about love to talking about career.  Jobs are the things they pursue.  Jobs are the things they long for.  One character (whom I’m really hoping doesn’t just end up being me) spends months on end trying to gain the attention of a company that slighted him; he contributes PR after PR to their open source project, and it helps them a lot, but he realizes they take him for granted.
The rest of the characters are also like that.  They don’t dream about love.  They don’t worship Jesus.  They dream about new jobs, and they worship the Church of Technology, and they believe that in contributing to technology that propagates, they will effectively live long after death.   Their work will spread, be revised, lead to more work.  They believe that by building in this way, they’ll give rise to a kind of meiosis that will make their creations never die, only get stronger with time.
It all takes place in Sacramento, but it’s a fictionalized Sacramento.  It’s Sacramento in this crazy parallel universe, a Sacramento that’s totally dominated by tech and populated mostly by young people and really, really, really expensive to live in.
If I ever bring myself to finish this novel, in markdown, maybe I’ll open source the private gitrepo it’s saved on.
0 notes
masaa-ma · 7 years ago
Text
KubernetesのConfig&Storageリソース(その2)
from https://thinkit.co.jp/article/14195
Config&Storageリソース
前回、利用者が直接利用するConfig&Storageリソースは3種類あることを紹介し、そのうちのSecretとConfigMapを解説しました。今回は、残る1種類であるPersistentVolumeClaimについて解説しますが、PersistentVolumeClaimを理解するために必要となるPersistentVolume、Volumeについても取り上げます。
5種類に大別できるKubernetesのリソース
リソースの分類内容Workloadsリソースコンテナの実行に関するリソースDiscovery&LBリソースコンテナを外部公開するようなエンドポイントを提供するリソースConfig&Storageリソース設定・機密情報・永続化ボリュームなどに関するリソースClusterリソースセキュリティやクォータなどに関するリソースMetadataリソースリソースを操作する系統のリソース
VolumeとPersistentVolumeとPersistentVolumeClaimの違い
Volumeは既存のボリューム(ホストの領域、NFS、Ceph、GCP Volume)などをYAML Manifestに直接指定することで利用可能にするものです。そのため、利用者が新規でボリュームを作成したり、既存のボリュームを削除したりといった操作を行うことはできません。また、YAML ManifestからVolumeリソースを作成するといった処理も行いません。
一方でPersistentVolumeは、外部の永続ボリュームを提供するシステムと連携して、新規のボリュームの作成や、既存のボリュームの削除などを行うことが可能です。具体的には、YAML ManifestなどからPersistent Volumeリソースを別途作成する形になります。
PersistentVolumeにもVolumeにも同じプラグインが用意されています。例えばGCPやAWSのボリュームサービスでは、Persistent VolumeプラグインとVolumeプラグインの両方が用意されています。Persistent Volumeプラグインの方ではVolumeの作成と削除といったライフサイクルを処理することが可能(PersistentVolumeClaimを利用すればDynamic Provisioningも可能)ですが、Volumeプラグインの場合はすでにあるVolumeを利用することだけが可能です。
PersistentVolumeClaimは、その名のとおり作成されたPersistentVolumeリソースの中からアサインするためのリソースになります。Persistent Volumeはクラスタにボリュームを登録するだけなので、実際にPodから利用するにはPersistent Volume Claimを定義して利用する必要があります。また、Dynamic Provisioning機能(あとで解説します)を利用した場合は、Persistent Volume Claimが利用されたタイミングでPersistent Volumeを動的に作成することが可能なため、順番が逆に感じられるかもしれません。
Volume
Kubernetesでは、Volumeを抽象化してPodと疎結合なリソースとして定義しています。Volumeプラグインとして、下記のような様々なプラグインが提供されています。下記のリスト以外にもあるので、詳細は「https://kubernetes.io/docs/concepts/storage/volumes/」を確認して下さい。
EmptyDir
HostPath
nfs
iscsi
cephfs
GCPPersistentVolume
gitRepo
PersistentVolumeとは異なり、Podに対して静的に領域を指定するような形になるため、競合などに注意してください。
EmptyDir
EmptyDirはPod用の一時的なディスク領域として利用可能です。PodがTerminateされると削除されます。
Tumblr media
EmptyDirのイメージ図
リスト1:EmptyDirを指定するemptydir-sample.yml
apiVersion: v1 kind: Pod metadata: name: sample-emptydir spec: containers: - image: nginx:1.12 name: nginx-container volumeMounts: - mountPath: /cache name: cache-volume volumes: - name: cache-volume emptyDir: {} $ kubectl apply -f emptydir-sample.yml
HostPath
HostPathは、Kubernetes Node上の領域をコンテナにマッピングするプラグインです。typeにはDirectory、DirectoryOrCreate、File、Socket、BlockDeviceなどから選択します。DirectoryOrCreateとDirectoryとの差は、ディレクトリが存在しない場合に作成して起動するか否かの違いです。
Tumblr media
[HostPathのイメージ図
リスト2:HostPathを使用するhostpath-sample.yml
apiVersion: v1 kind: Pod metadata: name: sample-hostpath spec: containers: - image: nginx:1.12 name: nginx-container volumeMounts: - mountPath: /srv name: hostpath-sample volumes: - name: hostpath-sample hostPath: path: /data type: DirectoryOrCreate $ kubectl apply -f hostpath-sample.yml
PersistentVolume(PV)
PersistentVolumeは、永続化領域として確保されるVolumeです。前述のVolumeはPodの定義内に直接書き込む形で接続を行っていましたが、Persistent Volumeはリソースとして個別に作成してから利用します。すなわち、YAML Manifestを使ってPersistent Volumeリソースを作成する必要があります。
また、PersistentVolumeは厳密にはConfig&StorageリソースではなくClusterリソースに分類されますが、今回は説明の都合上この章で説明しています。
PersistentVolumeの種類
PersistentVolumeは、基本的にネットワーク越しでディスクをアタッチするタイプのディスクとなります。シングルノード時のテスト用としてHostPathが提供されていますが、PersistentVolumeとしては実用的ではありません。PersistentVolumeはPluggableな構造となっており、一例として下記のようなものがあります。下記のリスト以外にもあるので、詳細は「https://kubernetes.io/docs/concepts/storage/persistent-volumes/」を確認して下さい。
GCE Persistent Disk
AWS Elastic Block Store
NFS
iSCSI
Ceph
OpenStack Cinder
GlusterFS
PersistentVolumeの作成
PersistentVolumeを作成する際には、下記のような項目を設定します。
ラベル
容量
アクセスモード
Reclaim Policy
マウントオプション
Storage Class
PersistentVolumeごとの設定
リスト3:PersistentVolumeを作成するpv_sample.yml
apiVersion: v1 kind: PersistentVolume metadata: name: sample-pv labels: type: nfs environment: stg spec: capacity: storage: 10G accessModes: - ReadWriteMany persistentVolumeReclaimPolicy: Retain storageClassName: slow mountOptions: - hard nfs: server: xxx.xxx.xxx.xxx path: /nfs/sample $ kubectl create -f pv_sample.yml
作成後に確認すると、正常に作成できたためBoundステータスになっていることが確認できます。
リスト4:PersistentVolumeの状態を確認
$ kubectl get pv NAME CAPACITY ACCESSMODES RECLAIMPOLICY STATUS CLAIM STORAGECLASS REASON AGE sample-pv 10Gi RWX Retain Bound 6s
以下、PersistentVolumeの設定項目について解説します。
ラベル
Dynamic Provisioningを使わずにPersistentVolumeを作成していく場合、PersistentVolumeの種類がわからなくなってしまうため、type、environment、speedなどのラベルをつけていくことをお勧めします。ラベルをつけていない場合、既存のPersistentVolumeの中から自動的に割り当てを行う必要が生じるため、ユーザの意志によるディスクのアタッチが困難になります。
Tumblr media
ラベルをつけなかった場合
一方でラベルをつけておくと、PersistentVolumeClaimでボリュームのラベルを指定できるで、スケジューリングを柔軟に行えます。
Tumblr media
ラベルをつけた場合
容量
容量を指定します。ここで注意するべきポイントは、Dynamic Provisioningが利用できない環境では、小さめのPersistentVolumeも用意することです。例えば下の図のよう状況で、PersistentVolumeClaimからの要求が3GBだった場合、用意されているPersistent Volumeの中から最も近い容量である10GBのものが割り当てられることになります。
Tumblr media
PersistentVolumeClaimとPersistentVolumeの実際の容量の相違
アクセスモード
アクセスモードは3つ存在しています。
PersistentVolumeのアクセスモード
モード内容ReadWriteOnce(RWO)単一ノードからRead/WriteされますReadOnlyMany(ROX)単一ノードからWrite、複数ノードからReadされますReadWriteMany(RWX)複数ノードからRead/Writeされます
PersistentVolumeによって、サポートしているアクセスモードは異なります。またGCP、AWS、OpenStackで提供されるブロックストレージサービスでは、ReadWriteOnceの��サポートされています。詳細は、https://kubernetes.io/docs/concepts/storage/persistent-volumes/を確認して下さい。
Reclaim Policy
Reclaim Policyは、PersistentVolumeを利用し終わった後の処理方法(破棄するか、再利用するかなど)を制御するポリシーです。
Retain
PersistentVolumeのデータも消さずに保持します
また、他のPersistentVolumeClaimによって、このPersistentVolumeが再度マウントされることはありません
Recycle
PersistentVolumeのデータを削除(rm -rf ./*)し、再利用可能時な状態にします
他のPersistentVolumeClaimによって再度マウントされます。
Delete
PersistentVolumeが削除されます
GCE、AWS、OpenStackなどで確保される外部ボリュームの際に利用されます
マウントオプション
PersistentVolumeの種別によっては、追加でマウントオプションを指定することが可能です。詳しくは各Persistent Volumeの仕様を確認して���さい。
Storage Class
Dynamic Provisioningの場合にユーザがPersistentVolumeClaimを使ってPersistentVolumeを要求する際に、どういったディスクが欲しいのかを指定するために利用されます。Storege Classの選択=外部ボリュームの種別選択となります。
例えばOpenStack Cinderの場合には、ボリュームを切り出す際に、どのバックエンド(Ceph、ScaleIO、Xtremioなど)か、どのゾーンかなどを選択可能です。
リスト5:Storage Classを指定するstorageclass_sample.yml
apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: name: sample-storageclass parameters: availability: test-zone-1a type: scaleio provisioner: kubernetes.io/cinder
PersistentVolume Pluginごとの設定
今回はNFSの例にしましたが、実際の設定項目はPersistentVolume Pluginごとに異なります。例えばspec.nfsは、GlusterFS Pluginを利用した場合には利用されません。
https://thinkit.co.jp/sites/default/files/main_images/14195_main.jpg
0 notes
dropshadows · 14 years ago
Link
> It allows you to see READMEs as they will be styled in GitHub Oh, you can preview Markdown documents in TextMate (Cmd + Opt + Ctrl + P), and here's a setting to replicate GitHub README style - which is easily better than all the default styles included with TextMate (Um Halloween?).
3 notes · View notes
rzcodes · 9 years ago
Text
git #2 - deploying while git push
Syncing your local copy of your project toward your ftp or sftp storage can be hard sometimes, but using pre-push hooks in git can somehow even make it easier. If you are ready to push your changes toward to your gitrepo, that usually also means it's ready to deploy (that's why we are using different branches during the developing sessions). So consider this as a hook for pushing or merging to master branch for example.
As to do that, first we have to define a script called pre-push in your git repo's hooks folder, as the folling:
cd /path/to/your/repository/.git/hooks
then create the file itself:
vi pre-push
It's going to be a bash script, so not to forget define it as:
#!/bin/sh
To upload the modified files, or the whole folder itself, we are going to use the ftp command.
In the script we have to define the credentials to the server, to be able to set up the connection:
#!/bin/sh HOST='yourhost' USER='youruser' PASSWD='userpass' LOCALPATH='path/to/your/local/project' FILE=*.* DIR='path/to/your/remote/folder'ftp -n $HOST <<EOF quote USER $USER quote PASS $PASSWD cd $DIR lcd $LOCALPATH put $FILE quit exit; EOF
Do not forget to make the pre-push script executable
chmod +x /path/to/your/repository/.git/hooks/pre-push
Please note, that if you are server host provied you ssh connection, consider using scp instead of ftp, as it's more secure. Also note, that using any integration tool for deploying, for example jenkins is the right method, consider this way as a playing method. Now, when you are pushing to your git repo, the files going to be send to your ftp storage.
0 notes
itstartswithlight · 9 years ago
Text
How to Unitialize a Git Repo
So, in the absence of posts where I wax philosophical (which was what I was initially envisioning for this blog) I am going to YET AGAIN spread good karma. (Which is, I suppose, is infinitely superior to waxing philosophical).
The other day, in my eagerness to get started on my project, I initialized THE WRONG DIRECTORY. Being the beginner that I am, it sent me into a flurry of Googling, and many unsuccessful attempts at undoing my problem. Finally, thank the Dieties, I found this simple command:
rm -rf .git
Props to the original thread on StackOverflow for saving my life, and the lives of many others!!!!
http://stackoverflow.com/questions/3212459/is-there-a-command-to-undo-git-init
0 notes
rzcodes · 9 years ago
Text
git #1 - syncing mysql to gitrepo
Developing webapplications often comes with using MySql. Not to mention git, where most of the developers stores their codes. Developing on localhost, with self hosted MySql can make it hard to keep it up with your database, which can casue tough times if you have some differency in your databases when deploying the application itself to public internet. So as to avoid any inconsistencies between your test database and your deployed one, here’s some little git trick, do make it easier to maintain the process of the developing.
As to automate the dumping process of your local database, I am using git hooks. To set up your git hooks, first navigate yourself to your project's git folder.
Create a file called pre-commit in your git's hooks folder:
/path/to/your/repo/.git/hooks/pre-commit
Once we are at the right spot, we have to define our dumping script as a pre commit:
#!/bin/bash mysqldump -u [mysql user] -p[mysql password] --skip-extended-insert [database] > /path/to/your/repo/[database].sql cd /path/to/your/repo git add [database].sql
In these lines we are telling the git, to dump our database to our git repo, and add it to be comitted.
Okay, if we are done, we have to make this script as executable. To do this:
chmod +x /path/to/your/repo/.git/hooks/pre-commit
One more important thng is missing: to write the post-merge script.
We are going to tell the system to restore the MySQL dump to the local database for the latest changes. To create our post-merge script.
Create a file called post-merge in your git's hooks folder:
/path/to/your/repo/.git/hooks/post-merge
and add the following lines:
#!/bin/bash mysql -u [mysql user] -p[mysql password] [database] < /path/to/your/repo/[database].sql
Please take care of both in the mysqldump and mysql commands, there is no space between the -p and the password.
then make it executable as well:
chmod +x /path/to/your/repo/.git/hooks/post-merge
0 notes